php - MYSQL Order BY "entry" DESC Not showing the highest -


i'm having slight problem mysql query.

          $sql = "select name videos order counter desc limit 5";       $result = mysql_query($sql, $conn) or trigger_error("sql", e_user_error);       $list = mysql_fetch_assoc($result);       while($list = mysql_fetch_assoc($result)){           echo $list['counter'];           echo "<br>";       }       mysql_free_result($result); 

want i'm wanting achieve listing 5 entrys order "counter" when listing it? shows 4 entrys :-

5648 4575 1595 35 

so 5th entry? , why isn't posting it? note 5th entry highest value of

305355 

thanks in advance

you fetch before loop pops 1 record off result set (i.e. 305355).

$list = mysql_fetch_assoc($result); // remove line while($list = mysql_fetch_assoc($result)) {   // output code } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -