php - Retrieving a column from mySQL database and passing to array -
i have constructed array manually, e.g.:
<?php $noupload = array('nick', 'cliff'); ?>
but trying populate array automatically users in mysql database. far have this:
<?php // make mysql connection $debug=false; $conn = mysql_connect("host","user","password"); // mysql connection data $db = mysql_select_db("database"); $query = "select * users access '%listen%'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $listen = "'". $row['login']. "', "; } ?>
$listen
constructs user list in way entered manually (i tested using echo), not sure how pass $noupload
. tried:
$noupload = array($listen);
but didn't work. think i'm close , grateful on final hurdle,
thanks,
nick
you can declare $listen
array
$listen = array(); while ($row = mysql_fetch_array($result)) { $listen[] = "'". $row['login']. "'"; }
Comments
Post a Comment