如何显示找到的搜索结果数量

时间:2015-01-08 03:41:52

标签: php

这是我的代码。如何在搜索感谢时输出数字结果

if(isset($_GET['search'])) {

$search_value= $_GET['searchbox'];



//$sql="SELECT idemp,sn FROM employee 
/    /WHERE idemp like '%$search_value%' OR
//sn like '%$search_value%'";

$sql = "SELECT * from application where (leave_id like '%$search_value%' OR id_no like                 '%$search_value%' OR type_of_leave like '%$search_value%' OR date_of_filing like '%$search_value%')";

       $result = $conn->query($sql);

       if ($result->num_rows > 0) {
         echo "Search results for '$search_value'";
       print "<br><br>";

       while ($row = $result->fetch_array()) {
.....
      close();
};

1 个答案:

答案 0 :(得分:2)

您可以使用以下内容显示总结果:

echo mysqli_num_rows($result);

OR

echo $result->num_rows;