时间:2021-07-01 10:21:17 帮助过:10人阅读
0".$where); $row = mysql_fetch_array($result, MYSQL_ASSOC); $count = $row['count']; //echo $count; if ($count > 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) $page = $total_pages; $start = $limit * $page - $limit; if ($start<0) $start = 0; $SQL = "SELECT * FROM `sale_orders` WHERE `number`>0".$where." ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query($SQL); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i = 0; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $responce->rows[$i]['order_id'] = $row['order_id']; $opt = "修改"; $responce->rows[$i]['cell'] = array ( $row['order_id'], $row['buyer-name'], $row['jj_sku'], $row['sku'], $row['product-name'], $row['quantity-purchased'], $opt ); $i++; } //print_r($responce); echo json_encode($responce); break; case 'add' : //新增 $pro_title = htmlspecialchars(stripslashes(trim($_POST['pro_title']))); $pro_sn = htmlspecialchars(stripslashes(trim($_POST['pro_sn']))); $size = htmlspecialchars(stripslashes(trim($_POST['size']))); $os = htmlspecialchars(stripslashes(trim($_POST['os']))); $charge = htmlspecialchars(stripslashes(trim($_POST['charge']))); $price = htmlspecialchars(stripslashes(trim($_POST['price']))); if (mb_strlen($pro_title) < 1) die("产品名称不能为空"); $addtime = date('Y-m-d H:i:s'); $query = mysql_query("insert into products(sn,title,size,os,charge,price,addtime)values('$pro_sn','$pro_title','$size','$os','$charge','$price','$addtime')"); if (mysql_affected_rows($conn) != 1) { die("操作失败"); } else { echo '1'; } break; case 'del' : //删除 $ids = $_POST['ids']; delAllSelect($ids, $conn); break; case '' : echo 'Bad request.'; break;}//批量删除操作function delAllSelect($ids, $conn) { if (empty ($ids)) die("0"); //mysql_query("update products set deleted=1 where id in($ids)"); mysql_query("delete FROM `sale_orders` WHERE order_id='$ids'"); if (mysql_affected_rows($conn)) { echo $ids; } else { die("0"); }}//处理接收jqGrid提交查询的中文字符串function uniDecode($str, $charcode) { $text = preg_replace_callback("/%u[0-9A-Za-z]{4}/", toUtf8, $str); return mb_convert_encoding($text, $charcode, 'utf-8');}function toUtf8($ar) { foreach ($ar as $val) { $val = intval(substr($val, 2), 16); if ($val < 0x7F) { // 0000-007F $c .= chr($val); } elseif ($val < 0x800) { // 0080-0800 $c .= chr(0xC0 | ($val / 64)); $c .= chr(0x80 | ($val % 64)); } else { // 0800-FFFF $c .= chr(0xE0 | (($val / 64) / 64)); $c .= chr(0x80 | (($val / 64) % 64)); $c .= chr(0x80 | ($val % 64)); } } return $c;}echo $page;echo $limit;echo $sidx;echo $sord;?>
楼主的数据库编码是什么呀,必须和页面统一哦。
qGrid 是一个用来显示网格数据的jQuery插件
传递给他的数据应该是 json,你就简单的
echo $page;
echo $limit;
echo $sidx;
echo $sord;
算什么?
echo $page;
echo $limit;
echo $sidx;
echo $sord;
因为后面两个变更我不知道什么意思,所以想输出一下看看
sale_list.html
jqGrid:强大的表格插件的应用-Helloweba演示平台 销售订单列表