What are you intending to do with $peek?  You only use it once and it's
sucking up one of your rows.

-jm

-----Original Message-----
From: Warren [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 21, 2001 5: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

---------------------------------------------------------------------
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

Reply via email to