I need help on this
Posted: Sun Dec 20, 2020 5:03 am
Am new to php,
i have a problem am trying to check if data already exist in my database but when i run the code it keeps on giving me errors.
error1-Warning: mysql_query() expects parameter 1 to be string, resource given in C:\wamp\www\New folder\trial\code.php on line 47
error2-Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\wamp\www\New folder\trial\code.php on line 48
here is the code..

i have a problem am trying to check if data already exist in my database but when i run the code it keeps on giving me errors.
error1-Warning: mysql_query() expects parameter 1 to be string, resource given in C:\wamp\www\New folder\trial\code.php on line 47
error2-Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\wamp\www\New folder\trial\code.php on line 48
here is the code..
Code: Select all
if(isset($_POST['submit_login']))
{
$username= $_POST['email'];
$password = $_POST['pass'];
$query2="SELECT * FROM customer_details WHERE email=\"$username\" AND password=\"$password\"";
$result2 = mysql_query($con,$query2);
$row=mysql_num_rows($result2);
if(!$row)
{
echo"Please try again";
}
else
{
header("Location:landing.html");
}
}