<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1016647" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1016647</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/sql-query#comment-1096991</link>
    <description> &lt;p&gt;thanks for reminding..&lt;/p&gt;
&lt;p&gt;i found out..the query should be like this:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT taker_name FROM quirex_record WHERE quiz_id = &amp;#039;$quiz_id&amp;#039; and month(FROM_UNIXTIME(time_finish)) = $month and year(FROM_UNIXTIME(time_finish)) = $year ORDER BY (no_correct/no_total) DESC, no_total DESC, (time_finish - time_begin) ASC, time_finish DESC LIMIT 1&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;i should put FROM_UNIXTIME instead of UNIX_TIMESTAMP..&lt;/p&gt;
&lt;p&gt;my mistake...&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Dec 2001 06:20:23 +0000</pubDate>
 <dc:creator>joyce</dc:creator>
 <guid isPermaLink="false">comment 1096991 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/sql-query#comment-1096990</link>
    <description> &lt;p&gt;A few ideas....&lt;/p&gt;
&lt;p&gt;1) If the times are stored in unix timestamp, you don&#039;t need to use the mySQL function UNIX_TIMESTAMP. That converts DateTime fields into unix timestamps.  So running that function on a unix timestamp may be messing it up.&lt;/p&gt;
&lt;p&gt;2) Put quotes around $month and $year in the query string.&lt;/p&gt;
&lt;p&gt;3) Standard debug... if the query is not working the way you expect, print it out.  Make sure that that PHP is generating the query the way you expect.  If it is, try copy &amp;amp; pasting it into phpMyAdmin and see what it does there.&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Dec 2001 06:07:07 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1096990 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/sql-query#comment-1096982</link>
    <description> &lt;p&gt;well, this query will get me the highest score for all the month..&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT taker_name FROM quirex_record WHERE quiz_id = &amp;#039;$quiz_id&amp;#039; ORDER BY (no_correct/no_total) DESC, no_total DESC, (time_finish - time_begin) ASC, time_finish DESC LIMIT 1&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;dates are stored in unix_timestamp..i want one query to return the highest for each month..for eg like if this month is december...it will only select the highest score for december only..&lt;/p&gt;
&lt;p&gt;i&#039;ve changed my query into this: it executed correctly but there was no results selected out. wat is wrong with my query??&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$month &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$year &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;Y&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;SELECT taker_name FROM quirex_record WHERE quiz_id &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;$quiz_id&#039; &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;and &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;month&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;UNIX_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;time_finish&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)) = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$month &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;and &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;year&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;UNIX_TIMESTAMP&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;time_finish&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)) = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$year ORDER BY &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;no_correct&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;no_total&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;DESC&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;no_total DESC&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;time_finish &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;- &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;time_begin&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;ASC&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;time_finish DESC LIMIT 1&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Dec 2001 02:39:12 +0000</pubDate>
 <dc:creator>joyce</dc:creator>
 <guid isPermaLink="false">comment 1096982 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/sql-query#comment-1096761</link>
    <description> &lt;p&gt;I have a few questions first...&lt;br /&gt;
1) How to you score an exam?&lt;br /&gt;
2) How do you have the dates stored? (it looks like 2 timestamps)&lt;br /&gt;
3) Do you want one query to return the highest for each month, or one query to return the highest for one month?&lt;/p&gt;
 </description>
     <pubDate>Thu, 20 Dec 2001 07:36:18 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1096761 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
