Page 1 of 1

First row not selecting? or last using DESC

Posted: Tue Jul 08, 2003 6:37 pm
by Darkside
I'm using the below code to select my rows.

Code: Select all

$result = mysql_query("SELECT ID, Name, Subject, Messto, Messages, date, Readmes FROM messages WHERE Messto = '" .$userїname]. "'");
$row = mysql_fetch_array($result);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
For some very odd reason even when i send 5 messages to user name 'darkside' the first row doesnt echo out? its just not there.

I only noticed this because I wanted to replace the above $result for

Code: Select all

$result = mysql_query("SELECT ID, Name, Subject, Messto, Messages, date, Readmes FROM messages WHERE Messto = '".$userїname]."' order by 'ID' DESC");
and here it was that last once assed and not the first?
I've got alot of code here so I'm not sure wot code ppl need to help me fix this but i think it has to be something to do with when I select the rows? I even tried just

Code: Select all

$result = mysql_query("SELECT ID, Name, Subject, Messto, Messages, date, Readmes FROM messages");
Any help wouldnt go a miss! thanks
darkside

Posted: Wed Jul 09, 2003 3:10 am
by Wayne

Code: Select all

$result = mysql_query("SELECT ID, Name, Subject, Messto, Messages, date, Readmes FROM messages WHERE Messto = '" .$userїname]. "'"); 
$row = mysql_fetch_array($result); 
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

remove this line :

Code: Select all

$row = mysql_fetch_array($result);