I think your command

    $peek = @mysql_fetch_row($ex);

fetches the first row - you don't output it - and the cursor goes
to the next row.
For all remaining rows you use mysql_fetch_array($ex) which
starts from the second row (see above). This results in n rows,
with the first one invisible and (n - 1) rows displayed.

What's the above line about? I can't see any sense behind it.
Remove it, and I think the thing will work...

Günther Pewny


Warren wrote:

> 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