I have a mySQL SELECT WHERE LIKE query on a MariaDB mySQL database which returns a queried email address. However when I perform the same query in php, it returns “Not found”. Any idea why?
Thanks
Robert
phpMyAdmin works:
USE birdbr7_Subscription;
SELECT * FROM `subscribe` WHERE `email` LIKE '%[email protected]%';
Result:
[email protected]
However:
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($dbname){
print "DataBase found";
}else{
print "DataBase not found";
}
// Perform query
$result = mysqli_query($conn, "SELECT * FROM `subscribe` WHERE `email` LIKE '%[email protected]%'");
if($result){
echo "Found";
}else{
echo "Not found";
}
// Close the connection
$conn->close();
?>
Returns: DataBase found Not found