MySQLi IN function finds a match in the given arguments.
The function returns 1 if expr is equal to any of the values in the IN list, otherwise, returns 0
Below the syntax of IN condition
EXPR IN(value1, value2,... valuen);
MySQLi IN function finds a match in the given arguments.
The function returns 1 if expr is equal to any of the values in the IN list, otherwise, returns 0
Below the syntax of IN condition
EXPR IN(value1, value2,... valuen);
<?php
$conn = mysqli_connect('localhost:3306', 'user_name', 'password', 'db_nexladder');
if(! $conn) {
die('Could not connect: ' . mysqli_error());
}
$sql = "SELECT * FROM `tbl_customers` WHERE `id` IN (3, 5, 7)";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_object($result)) {
echo "Name: " . $row->first_name. "<br />";
}
} else {
echo "0 rows";
}
mysqli_close($conn);
?>
Below it'll look like: