zgkhoo Posted November 15, 2007 Share Posted November 15, 2007 mysql data must fetch by while loop? eg. while($row = mysql_fetch_array($result,MYSQL_ASSOC)){ can i use for loop instead of while loop? thanks in advance Link to comment https://forums.phpfreaks.com/topic/77459-solved-mysql-data-must-fetch-by-while-loopcan-i-use-for-loop/ Share on other sites More sharing options...
kopytko Posted November 15, 2007 Share Posted November 15, 2007 Yes, you can use for loop. Like this: <?php $res = mysql_query("select * from table"); for($i=0,$count=mysql_num_rows($res);$i<$count;$i++) { print_r(mysql_fetch_assoc($res)); echo '<br />'; } ?> Link to comment https://forums.phpfreaks.com/topic/77459-solved-mysql-data-must-fetch-by-while-loopcan-i-use-for-loop/#findComment-392142 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.