-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 $peek=@mysql_fetch_row($ex); while($row = mysql_fetch_array($ex)) at that point in your code the first call to mysql_fetch_row() moves the result pointer up one position.. therefore, losing your first row. if you have to have $peek.. make a call to mysql_data_seek($ex,0); then you will move the result pointer back to row 0. - --------------------- Johnny Withers [EMAIL PROTECTED] p. 601.853.0211 c. 601.954.9133 - -----Original Message----- From: Warren [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 21, 2001 7:33 PM To: [EMAIL PROTECTED] Subject: seemingly anomalous behaviour in Selects entered manually vs. in a script Hi! I've got this seemingly anomalous situation that occurs when using a SELECT. If I use the MYSQL command line thing and SELECT * FROM QUESTIONS, it tells me that there are 7 rows in the set. There are, in fact 7 rows. Perfect. HOWEVER, if I execute the following script I always get 1 row fewer than exist. If there ought to be only 1 row in the result I get nothing displayed! ============ SNIP ============ <?php MYSQL_CONNECT("localhost","yourID","yourPASSWORD"); mysql_select_db("yourDATABASE"); $ex=@MYSQL_QUERY("select * from questions where uid='1' "); echo '<table width="95%" border="1" cellspacing="4" cellpadding="4" align="center" bgcolor="#FFFFCC" bordercolorlight="#CCCCFF" bordercolordark="#999999">'; echo "<form action=\"integrateTest.php3\" method=\"GET\">"; //THE NEXT TWO LINES -- TRY EXECUTING ONE SELECT AND THEN COMMENT THE OTHER LINE AND EXECUTE THE OTHER SELECT //$ex=@MYSQL_QUERY("select * from questions where uid='1' "); $ex=@MYSQL_QUERY("select * from questions "); $peek=@mysql_fetch_row($ex); while($row = mysql_fetch_array($ex)) { $var=$row["uid"]; echo "<tr> <td><div align=\"left\">"; echo "<b>select: </b><input type='checkbox' name='ID[]' value='$var'>"; echo "</b></div> <div align=\"left\"><b>Question:</b> $row[question]</div></td> </tr>"; } echo "</table>"; echo ' <p align=center><input type="submit" name="Submit" value="Create Test"> </form></p>'; ?> ============ SNIP ============ I suspect that it is something ridiculous that I am doing (or not doing), but I just don't see it. Would someone mind setting me straight on what I'm not doing correctly? Thanks heaps! - -Warren - --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com> iQA/AwUBOpR+jLFNxPoD98ryEQLdaACgoxEM6vnrWxzilBeSI+GNeQLDFCYAnRq6 0NMjNjdNvxbxMdcwGDqDn6Y5 =ZxYb -----END PGP SIGNATURE----- --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php