while loop driving me crazy
| From: | (Miles Thompson) | Date: | Wed, 21 Feb 2001 15:01:14 +0000 |
| Subject: | while loop driving me crazy | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6830@lists.php.net to get a copy of this message | ||
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