[BNM] SQL statement shaves off 1 top/bottom result
Ian Barber
gonz-bnm at raegunne.com
Wed May 24 13:25:51 BST 2006
You seem to be fetching the first row just after the SQL, then fetching
another in the while()
Ian
delarge wrote:
> Helloo...
>
> In SQL land... this has happenend before to me... a php while loop
> will shave off the top result whether sorted by DESC or not...
> using SQL 5.0 database...
>
> My simple code goes:
>
> $sql_nav = "SELECT id, title, date_format(dateposted, '%d %M %y') as
> dateposted FROM owenpnews WHERE category = '$subcategory' ORDER BY id
> DESC"; $result = mysql_query($sql_nav) or
> die(mysql_error().'<p>'.$sql_nav.'</p>');
>
> $row = mysql_fetch_array($result);
^^^^^^^^^^^^^HERE^^^^^^^^^^^^^^^^
>
>
> if ($subcategory == "Illustration") {
> while($row = mysql_fetch_array($result))
> {
> $id = "$row[id]";
> $title = "$row[title]";
> $dateposted = "$row[dateposted]";
> echo"<li class=\"subnav\"><a href=\"/item/?$id\">$title</a></li>";
> } // end while
> } // end if
>
> -----------------------------
> It just will not display the top result / or bottom one if reversed!
> I can't see naything wrong with the code... anyone ever had this? Is
> it a setting in the databse/myadmin?
>
>
> --
> Paul Burgess
>
> http://delarge.co.uk
> http://streetstickers.co.uk
> http://iampaulburgess.co.uk
More information about the BNMList mailing list
BNMList is hosted by Screenlists, a Screen-Play.net service