mysql - How do I store the results of an SQL call in a php array -
i have been trying create sign form website , keep struggling trying check if user's username had been used else signed website in past. using mysql database store information , trying access past usernames through using php. specific part of code keeps returning error.
$query = "select username users"; $records = mysql_query("select username users"); $result = mysql_query($records); $result_array = array(); while($row = mysql_fetch_assoc($result)) { $result_array[] = $row['username']; } the error messages receiving are:
- warning: mysql_query() expects parameter 1 string, resource given in ...
- warning: mysql_fetch_assoc() expects parameter 1 resource, null given in... thank much!
the problem doing mysql_query twice 1 on $records variable , on resultlike so:
$records = mysql_query("select username users"); $result = mysql_query($records); what need this:
$records = "select username users"; $result = mysql_query($records);
Comments
Post a Comment