EasyUi数据搜索在PHP7.6版中不起作用,但在PHP5.6版中运行良好。
如何修复此错误?有人能帮我解决这个问题吗?我是php新手。
请在下面找到我的密码。
<?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);
?>发布于 2017-09-28 07:12:41
我修改了我的php代码,如下所示。现在一切都很好。
<?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);
?>发布于 2017-09-26 10:59:42
请使用mysqli或pdo作为数据库扩展,没有mysql,所以不要使用"mysql_query“,而要使用"mysqli_query”等等。
https://stackoverflow.com/questions/46424257
复制相似问题