I wanted to know if it was possible to write the following expression
while($row = mysql_fetch_array($result))
with a “for loop” instead of a “while loop.” So that the below code would print the same result.
while($row = mysql_fetch_array($result)){
echo $row['name'];
}
EDIT: I use PDO I just thought this would be an expression more people have seen. And as far as the answers go, yeah I agree it would be pointless. I’m just having trouble understanding how the internal pointer increments.
It would be really pointless, but you could do:
However, you should seriously consider using PDO.