In phpMyAdmin the query
SELECT * FROM table WHERE value1 LIKE '%O%' OR value2 LIKE '%1%'
nicely returns all rows containing O or 1.
But the same query implemented in a PHP script only returns the first row matching O or 1. Instead off all rows matching O or 1.
This is my current PHP script:
mysqli_select_db ($con, $database) or die (mysqli_error());
$sqli = mysqli_query ($con,"SELECT * FROM table WHERE VALUE1 LIKE '%O%' OR VALUE2 LIKE '%1%'") or die (mysqli_error());
$echo = mysqli_fetch_assoc($sqli);
if (empty ($echo))
{
echo "No matching results found.";
}
else
{
echo "<table width='50%' border='1'>";
echo "<tr><th>VALUE1</th><th>VALUE2</th></tr>";
echo "<tr><td>{$echo["VALUE1"]}</td>";
echo "<td>{$echo["VALUE2"]}</td></tr>";
}
The output is only the first matching row. Instead of all matching rows. Also when I use print_r instead of table rows.