On 25 Jul 2002 at 2:04, GOLD, MATTHEW wrote: > thank you very much for your quick response. > > How do I run mysql_fetch_row before the while loop? I don't want two > loops, because I just want this variable to print out once. > > I tried this, but it didn't work: > > $query = "Select blah1, blah2, blah3 from blahtable"; > $result = mysql_query ($query) > or die ("Cannot complete query"); > > $row = mysql_fetch_row ($result)) > print ("$row[4]"); > > while ($row = mysql_fetch_row ($result)) > { > print "$row[1], $row[2], etc."); > } > > ?> > > I realize that my problem is that I don't really understand arrays...but I > am new to all of this, and I very much appreciate your help. > > best, > > Matt
Not sure if I responded to this, so .... $query = "Select blah1, blah2, blah3 from blahtable"; $result = mysql_query ($query) or die ("Error: ". $mysql_error() ) //mysql_error gives you a useful error message! // or die ("Cannot complete query"); $row = mysql_fetch_row ($result)) print ("$row[4]"); mysql_data_seek($result, 0); //Reset pointer to first record while ($row = mysql_fetch_row ($result)) { print "$row[1], $row[2], etc."); } ?> You might want to look at extract as well. Cheers -- David Robley Temporary Kiwi! Quod subigo farinam "This is mutiny!" said Tom bountifully. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php