RE: [PHP-DB] while loop driving me crazy
| From: | Chris Andrew | Date: | Wed, 21 Feb 2001 15:37:59 +0000 |
| Subject: | RE: [PHP-DB] while loop driving me crazy | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6832@lists.php.net to get a copy of this message | ||
Remove the semi-colon after your while() statement.
> -----Original Message-----
> From: Miles Thompson [mailto:milesthompson@ns.sympatico.ca]
> Sent: 21 February 2001 15:01
> To: php-db@lists.php.net
> 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: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net