Canman2005 Posted May 25, 2008 Share Posted May 25, 2008 Hi all I have an array in my php code $aUsers = array( "Ädams, Egbert", "Zaun, Jillie", ); Is there anyway to populate the array with a SQL query such as $sql = "SELECT * FROM `members`"; $show = @mysql_query($sql,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($show)) { print "name" } Any help would be smashing Thanks in advance Dave Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 25, 2008 Share Posted May 25, 2008 If I understand what your wanting, try this: <?php $aUsers = array( "Ädams, Egbert", "Zaun, Jillie", ); $sql = "SELECT * FROM `members`"; $show = @mysql_query($sql,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($show)){ $aUsers[] = $row['name']; } //new array with names added echo '<pre>',print_r($aUsers),'</pre>'; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.