I have two tables and both tables have a field with the same name (mobile). I want to make sure that neither table contains the value. I want to know how many rows the phone has in either table.
my code :
$sql2 = "SELECT * FROM members WHERE mobile = ".$mobile."
UNION
SELECT * FROM users WHERE mobile = ".$mobile."";
$result = $con->query($sql2);
if ($result->num_rows > 0) {
echo "Value exists in the first or second table.";
} else {
echo "Value does not exist in the first or second table.";
}
this err : Notice: Trying to get property 'num_rows' of non-object in