This question already has an answer here:
- mysql_num_rows error 3 answers
I know this question has been asked loads of times, and I have looked at the answers but I cant get my code to work correctly. The code I have tried is displayed below.
<?php
include 'connection.php';
$connection=mysqli_connect("localhost","root","","c3392262");
if (isset($_POST['search'])) {
$search = $_POST['search'];
if (!empty($search)) {
$query = "SELECT name FROM products WHERE name LIKE '%$search%'";
$query_run = mysqli_query($connection, $query);
if (mysql_num_rows($query_run)>=1) {
echo 'found';
} else {
echo 'No results found';
}
}
}
?>
<form name = "searchbar" method = "POST" action = "searchBar.php">
<input name = "search" type = "text" size = "40" maxlength = "50" >
<input type="submit" value="Submit">
</form>
</div>