I have been trying to create a sign up form for a website and I keep struggling with trying to check if a user's username had been used by someone else who signed up for the website in the past. I am using a Mysql database to store information and am trying to access past usernames through it using php. This specific part of my code keeps returning an error.
$query = "SELECT username FROM users";
$records = mysql_query("SELECT username FROM users");
$result = mysql_query($records);
$result_array = array();
while($row = mysql_fetch_assoc($result))
{
$result_array[] = $row['username'];
}
The error messages I am receiving are:
- Warning: mysql_query() expects parameter 1 to be string, resource given in ...
- Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in... thank you so much!