I'm a beginner C programmer. I recently started learning PHP and MySQL and encountered this interesting behavior with while loop:
while ($pages = mysql_fetch_array($pages_set))
{statement}
I previously learned that condition must be changed somewhere in the loop (or in the expression itself) in order for the loop to be finite, but in this case i just can't see it.
I researched a bit about mysql_fetch_array() function and found this:
Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.
Is it true to say that the pointer moves through the row and when it reaches the end it will return 0 or NULL?
mysql_xxx()
functions are deprecated. You should use either themysqli_xxx()
alternatives or the PDO library instead. See the PHP manual for more info. However, with either of these libraries, similar constructs are possible, so your question is still relevant. – Spudley Jul 31 '12 at 19:46