Dear Friends,
Help me to fix this..
Error Message : mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in
Code is,

<?php
$database=$diocese;
$table=$category;


//capture search term and remove spaces at its both ends if the is any
$searchTerm = trim($_GET['query']);


//check whether the name parsed is empty
if($searchTerm == "")
{
    echo "Enter name you are searching for.";
    exit();
}

//database connection info
$host = "localhost"; //server
$db = $_GET['db']; //database name
$user = "root"; //dabases user name
$pwd = ""; //password
$table = $_GET['fundcat'];

//connecting to server and creating link to database
$link = mysqli_connect($host, $user, $pwd, $db);

//MYSQL search statement
$query = "SELECT * FROM '%$table%' WHERE Fund Name LIKE '%$searchTerm%'";

$results = mysqli_query($link, $query);

/* check whethere there were matching records in the table
by counting the number of results returned */
if(mysqli_num_rows($results) >= 1)
{
    $output = "";
    while($row = mysqli_fetch_array($results))
    {
        echo '<table>';
Member Avatar for LastMitch

@Shalomd

mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in

There's something wrong with this query:

$query = "SELECT * FROM '%$table%' WHERE Fund Name LIKE '%$searchTerm%'";

Do you have a $table & $searchTerm in your table or database?

commented: Yes. Have +0

Yes Have

What are you trying to accomplish?

This could work (depending on your table structure):

$query = "SELECT * FROM `$table` WHERE `Fund Name` LIKE '%$searchTerm%'";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.