Problems connecting to MySQL with PHP?

light

New member
I am writing a login script. This part is supposed to authenticate the user when they enter their email and password, but I keep getting the same error message, below:

Warning: mysql_query() expects parameter 1 to be string, resource given in C:\xampp\htdocs\own_login\authenticate.php on line 28
Could not execute query

below is the PHP script from line 24 - 28

#create SQL query
$sql = mysql_query("SELECT * FROM users WHERE email = \"$email\" and password = \"$password\"");

#execute query
$rs = mysql_query($sql,$conn) or die("Could not execute query");

Please help. Thanks
 
I have tried to make my own login script in PHP and I know its damned hard work for a beginner.

Try

$sql = mysql_query("SELECT * FROM users WHERE email = '".$email."' AND password = '".$password."'");

Notice the extra apostrophes. Hope this has helped.
 
Back
Top