Q: Easyui datagrid search is not working EasyUi datagrid search is not working in php version 7.6 but it is working fine in php version 5.6.
How do i fix this error? Anyone can help me to fix this problem?. I am newbie to php.
Please find my code below.
<?php
include 'conn.php';

$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$itemid = isset($_POST['id']) ? mysql_real_escape_string($_POST['id']) : '';
$productid = isset($_POST['proc_id']) ? mysql_real_escape_string($_POST['proc_id']) : '';

$offset = ($page-1)*$rows;

$result = array();

$where = "id like '$itemid%' and proc_id like '$productid%'";
$rs = mysql_query("select count(*) from details_v9 where " . $where);
$row = mysql_fetch_row($rs);
$result["total"] = $row[0];

$rs = mysql_query("select * from details_v9 where " . $where . " limit $offset,$rows");

$items = array();
while($row = mysql_fetch_object($rs)){
    array_push($items, $row);
}
$result["rows"] = $items;

echo json_encode($result);
?>


A: please use mysqli or pdo as database extension  no mysql
so instead of "mysql_query" use "mysqli_query" and etc...

A: I modified my php code like below. It is working fine now.
<?php
include 'conn.php';

$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$itemid = isset($_POST['id']) ?  $_POST['id'] : false;
$productid = isset($_POST['proc_id']) ? $_POST['proc_id'] : false;

$offset = ($page-1)*$rows;

$result = array();

$where = "id like '$itemid%' and proc_id like '$productid%'";
$rs = mysql_query("select count(*) from details_v9 where " . $where);
$row = mysql_fetch_row($rs);
$result["total"] = $row[0];

$rs = mysql_query("select * from details_v9 where " . $where . " limit $offset,$rows");

$items = array();
while($row = mysql_fetch_object($rs)){
    array_push($items, $row);
}
$result["rows"] = $items;

echo json_encode($result);
?>

