I have seen the code for this before on here and it worked so I don't know why this isn't. I am using a require to bring in a db function:
function connectDB(){
$user="";
$host="";
$pass="";
$db_name="";
$connect_db = @mysql_connect($host,$user,$pass);
return $connect_db;
};
and then I call the connectDB() function from within this function:
function getUsersArray(){
if (!$connect_db) {
echo("Database reported an error. Please try again.<BR>");
} else {
// Connect and get username array
mysql_select_db ($db_name);
$query = mysql_query("SELECT username FROM users");
while ($row = mysql_fetch_assoc ($query)) {
echo "<OPTION VALUE=\"" . $row["username"] . "\">" . $row["username"] . "</OPTION>";
};
mysql_free_result ($query);
mysql_close($connect_db);
};
};
...this doesn't work for some reason.
Anyone have a clue?