<?php
$connect = mysqli_connect("localhost","root","muarem1");
mysqli_select_db($connect,"my_db");
if(isset($_GET['search'])){
$searchvalue = $_GET['value'];
$query = "SELECT * FROM `my_db`.`sites` WHERE `site_keywords` $searchvalue='%$searchvalue%'";
$try = mysqli_query($connect,$query);
if ( mysqli_num_rows($try)<= 0) { echo "<br><center>Sorry, no results found for <b>$searchvalue</b>. Try different search or check back again later. </center></br> ";}
else {
while($row = mysqli_fetch_array($try))
{
$title = $row['site_title'];
$link = $row['site_link'];
$desc = $row['site_desc'];
echo "<h1>$title</h1><a href='$link'>$link</a><p>$desc</p>";
}
}
}
?>
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\Users\muarem\mywebsite\test.php on line 22
без излишни коментари
$connect = mysqli_connect("localhost","root","muarem1");
mysqli_select_db($connect,"my_db");
if(isset($_GET['search'])){
$searchvalue = $_GET['value'];
$query = "SELECT * FROM `my_db`.`sites` WHERE `site_keywords` $searchvalue='%$searchvalue%'";
$try = mysqli_query($connect,$query);
if ( mysqli_num_rows($try)<= 0) { echo "<br><center>Sorry, no results found for <b>$searchvalue</b>. Try different search or check back again later. </center></br> ";}
else {
while($row = mysqli_fetch_array($try))
{
$title = $row['site_title'];
$link = $row['site_link'];
$desc = $row['site_desc'];
echo "<h1>$title</h1><a href='$link'>$link</a><p>$desc</p>";
}
}
}
?>
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in D:\Users\muarem\mywebsite\test.php on line 22
без излишни коментари