SQL LIKE运算符不返回行

This is my MySQL statement, I want to search record by status or description.. this statement works fine in phpMyAdmin, but it is not working in php script.. Any Suggestions Please..

$result = mysqli_query($mysqli, 
    "SELECT * FROM `statuses` 
    where statuses.`status` LIKE  '%$search%' OR 
    statuses.`description` LIKE  '%$search%'");

I hope you write everything correct but there may be error in how you fetching data. Here are the things you need to check.

  • check your connection string

  • If you are retrieving data then use something like below

    while($row = $result->fetch_array()) { echo $row['example_col_name']; }

  • You can do one more thing if everything alright store your query to a variable and echo out that one then you will see what query is passing .