What im trying to do is checking if a value exists in the table.If it does not exist a sorry message should be displayed.The code is posted below even though the value exists it always return sorry
if ($mysqli->query("SELECT 1 FROM `users` WHERE `k1`='$string1' AND 'k2'='$string2'"))
{
if($mysqli->affected_rows==0)
{
printf("Sorry");
}
}
You will need to use
As you are making query as SELECT statement.