I want to check if a user is already there on my 'sellers' table by checking if his email already exists on the table. If it exists, i want to skip the insertion of a new record, else insert the new seller. the code is as follows:
$email = $_REQUEST['semail'];
$sql = 'SELECT Email FROM project2.sellers WHERE Email = :email';
$s = $pdo->prepare($sql);
$s->bindValue(':email', $email);
$s->execute();
if (!$s) {
}
if (mysql_num_rows($s)!=0) {
echo "exists";
}
else
{
$sql = 'INSERT INTO project2.sellers SET
Type = :stype;
Name = :sname;
Email = :semail;
Phone = :sphone;
Location = :location;
City = :city';
$s = $pdo->prepare($sql);
$s->bindValue(':stype', $_REQUEST['stype']);
$s->bindValue(':sname', $_REQUEST['sname']);
$s->bindValue(':semail', $_REQUEST['semail']);
$s->bindValue(':sphone', $_REQUEST['sphone']);
$s->bindValue(':location', $_REQUEST['location']);
$s->bindValue(':city', $_REQUEST['city']);
$s->execute();
}
header('location: ../'.$_REQUEST['category']);
please tell me where am i going wrong