Questions about the Jqgrid

Source: Internet
Author: User
Tags jqgrid
Questions about the Jqgrid
One. The local test can display the database data, uploaded to the server on the display, SQL has been tested in phpMyAdmin, can be used, how to check what is the reason.

Two. Coding problem, the page was encoded as GB, I put sale_list.html and do.php with Notepad to utf-8, local test Jqgrid will not show the data.

do.php Source
 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 = "Sele CT * 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 = "Modify"; $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 '://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 ("Product name cannot be empty"); $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 ("operation failed");} else {echo ' 1 ';} Break;case ' del '://delete $ids = $_post[' IDs '];d elallselect ($ids, $conn); Break;case ': Echo ' bad Request '; break;} Bulk Delete operation 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");}} Handles the Chinese string function Unidecode ($STR, $charcode) that receives the Jqgrid submission query {$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), +), if ($val < 0x7F) {//0000-007f$c. = Ch R ($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; >


Reply to discussion (solution)

Landlord's database code is what ah, must and page unity Oh.

Qgrid is a jquery plugin for displaying grid data
The data passed to him should be JSON, and you would simply
Echo $page;
Echo $limit;
Echo $sidx;
Echo $sord;
What's the count?

Echo $page;
Echo $limit;
Echo $sidx;
Echo $sord;
Because the next two changes I don't know what that means, so I want to output a bit to see
Sale_list.html

 
  
 
 
  
 
 
  
 <title>Jqgrid: Powerful form plug-in application-helloweba demo platform</title>
 
 
  
 
 
  
 
 
  
 
 
  
 

Sales order List

Order Number: product name £ º
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.