DeanWhitehouse Posted October 1, 2008 Share Posted October 1, 2008 I have a while loop for mysql_fetch_assoc(); , and i want to put a certain thing into an array should i do it this way or will mysql_fetch_array(); do it? $sqk = "SELECT * FROM guestbook"; $sqk = mysql_query($sqk); $arr = array(); /*while($wir = mysql_fetch_assoc($sqk)) { $arr .= $wir['en_avatar']; }*/ $arr = mysql_fetch_array($sqk); //echo $arr; echo $arr['1']; Edit: I need to put all the avatar images into one array , to make my image preloader Link to comment https://forums.phpfreaks.com/topic/126666-solved-adding-data-to-array-in-while-loop/ Share on other sites More sharing options...
DarkWater Posted October 1, 2008 Share Posted October 1, 2008 Uhh... <?php $sqk = "SELECT * FROM guestbook"; $sqk = mysql_query($sqk); $arr = array(); while ($wir = mysql_fetch_assoc($sqk)) { $arr[] = $wir['en_avatar']; } print_r($arr); ?> Link to comment https://forums.phpfreaks.com/topic/126666-solved-adding-data-to-array-in-while-loop/#findComment-655085 Share on other sites More sharing options...
DeanWhitehouse Posted October 1, 2008 Author Share Posted October 1, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/126666-solved-adding-data-to-array-in-while-loop/#findComment-655087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.