I'm doing a MySQL query in a PHP file. I have an array ($country) with multiple names of countries and I want to select the rows of those countries from my table.
$country is the following array:
Array
(
[0] => Afghanistan
[1] => Armenia
[2] => Bhutan
)
I'm using the following code:
$result = mysqli_query($con,"SELECT *
FROM table1
WHERE table1.country='".$country."'");
However, the following statement works for an only country:
$result = mysqli_query($con,"SELECT * FROM table1 WHERE table1.country='".$country[1]."'");
But it doesn't work, whn I try: mysqli_num_rows() of the $result it says that the parameter is a booelan(That's because the query fails and it returns a false). Does anyone know what is the error?
This is the table1 structure: