gazalec Posted February 6, 2007 Share Posted February 6, 2007 i was just wondering if its possible to make a loop from an SQL database i.e $i=0; while ($i < $num) { $code=mysql_result($result,$i,"code"); $i++; } into an array??? Link to comment https://forums.phpfreaks.com/topic/37351-loop-into-an-array/ Share on other sites More sharing options...
trq Posted February 6, 2007 Share Posted February 6, 2007 <?php $i=0; while ($i < $num) { $code[] = mysql_result($result,$i,"code"); $i++; } ?> $code is now an array. Link to comment https://forums.phpfreaks.com/topic/37351-loop-into-an-array/#findComment-178584 Share on other sites More sharing options...
Psycho Posted February 6, 2007 Share Posted February 6, 2007 OR, also: <?php while ($record = mysql_fetch_assoc($result)) { $code[] = $record['code']; } ?> Link to comment https://forums.phpfreaks.com/topic/37351-loop-into-an-array/#findComment-178590 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.