我尝试使用 mysql_num_rows 函数计算 num_rows,但一直出现错误。我的查询没有错误。可能是什么问题呢
<?php
if(isset($_POST['search'])){
$search = $_POST['search'];
// connect to database
$con = mysqli_connect("localhost", "root","", "ajax") or die ("could not connect to database");
$query = "SELECT * FROM searchengine WHERE title LIKE '%$search%' ";
$get_query = mysqli_query($con, $query) or die("can't execute query");
$rows = mysqli_fetch_array($get_query);
$num = mysql_num_rows($get_query);
echo $num;
while($row = mysqli_fetch_array($get_query)){
echo "resuslts found ".'<br/>';
echo $row['title'];
}
}
else{
echo " not set";
}
?>