yakk0 Posted November 11, 2008 Share Posted November 11, 2008 I'm trying to get this while script to work and get it to run in a loop for 100 times only. But I just don't what I'm doing wrong, I'm sort of a newbie at using PHP. while($row = mysql_fetch_array($result); $count<=100; $count++) Link to comment https://forums.phpfreaks.com/topic/132332-question-for-while/ Share on other sites More sharing options...
premiso Posted November 11, 2008 Share Posted November 11, 2008 You are using a while in a for format. <?php $count = 0; // removed the $row = mysql cause that would end the loop prematurely while ($count <= 100) { if ($row = mysql_fetch_array($result)) { // process here } $count++; } ?> That should work for what you want. With a for statement it would look like this: <?php for ($count=0; $count<=100; $count++) { if ($row = mysql_fetch_array($result)) { // processing here } } ?> Link to comment https://forums.phpfreaks.com/topic/132332-question-for-while/#findComment-688002 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.