Remove the semi-colon after your while() statement.

> -----Original Message-----
> From: Miles Thompson [mailto:[EMAIL PROTECTED]]
> Sent: 21 February 2001 15:01
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] while loop driving me crazy
> 
> 
> I've used a similar structure hundreds of times, but the following isn't 
> working:
> 
> $result = mysql_query($sql, 
> $db); 
> 
> if( !$result ) { echo "No result code in SQL send. <br>"; 
> }
> if( mysql_num_rows( $result ) >= 1 
> )
> { 
> 
>     echo "Rows fetched: ", mysql_num_rows( $result ), 
> "<br>";
>     while( $row = mysql_fetch_array( $result ) ) 
> ;
>     { 
> 
>        //$password = $row[ password 
> ];
>        //$first_name = $row[ first_name 
> ];
>        //$last_name = $row[ last_name 
> ];
>        //$email = $row[ email 
> ];
> 
>        echo "In the 
> while!!<br>"; 
> 
>        echo $row[ password ] . "<br>" ;
> 
>        // there will be code here to build and send an email
> 
>     } 
> 
>     echo 
> "<hr>"; 
> 
>     echo "Mailing of passwords completed. 
> <br><br>" 
> 
>     echo "<input type = \"submit\" name = \"action[]\" value= \" 
> $Close \" 
> onclick=\"window.close()\"></td>";
> } 
> 
> 
> The sql statement show below has been tested interactively, it 
> does return 
> 5 records and none of them are nulls.
> --- begin sql ---
>     select first_name, last_name, password, email from subscriber where 
> lpasswd_mailed = 0 and email != ''
> --- end sql ---
> 
> Here's the output from the browser:
> ---------- top of browser -------
> Rows fetched: 5
> In the while!!
> <horizontal rule >
> Mailing of passwords completed.
> <CLOSE BUTTON>
> --------end of output ----------
> 
> I believe it should show, in addition to the record count..
>            "In the while" 5 times, interspersed with password values.
> 
> What is the dumb obvious thing I'm missing?
> 
> Regards - Miles Thompson
> 
> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to