Dave G wrote:

        In the example they give in this book, they use a "while" loop
(page 670, for anyone who has it). But it's confusing because it looks
like this:
        while ( $subscriber = mysql_fetch_row($result))
        {
        [write and send the email]
        }
        $subscriber is probably an array, filled with the email address
and information about the mailing list subscriber. But in the rest of
the script I can't find where they declare and fill this array. But more
than that, I can't understand how this "while" loop would ever stop
running. Nothing seems to change $subscriber within the "while" loop's
control structure. It doesn't ever say anything like "$subscriber ++1".
Nor does $result have anything act upon it which would change it. So to
me they both look static, and this loop looks endless.

In PHP, the equal sign returns the value assigned. For instance, this will output 5 and set $foo to 5:

print $foo = 5;

Now, the mysql_fetch_row function returns an array of results, or false if it's gone through all the results (it automagically knows which result it's on). If it's the last row, $subscriber is set to false and false is given for the loop condition.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to