About jqgrid
I. The local test can display the database data, but the data cannot be displayed after being uploaded to the server. SQL has been tested in phpmyadmin and can be used. how can I check the cause.
II. Question: The page is in gb. after I convert sale_list.html and do. php into UTF-8 using Notepad, the data cannot be displayed in the local jqgrid test.
Do. php source code
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 = "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 ($ respon Ce); 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 blank "); $ 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 ['id']; delAllSelect ($ ids, $ conn); break; case '': echo 'bad request. '; break;} // batch 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 =' $ kids'"); if (mysql_affected_rows ($ conn) {echo $ ids;} else {die ("0") ;}}// process the function uniDecode ($ str, $ charcode), a Chinese string that receives the jqGrid request) {$ 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) {// else -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 ;?>
Reply to discussion (solution)
What is the landlord's database code? it must be consistent with the page.
QGrid is a jQuery plug-in used to display grid data.
The data passed to him should be json. you can simply
Echo $ page;
Echo $ limit;
Echo $ sidx;
Echo $ sord;
What is it?
Echo $ page;
Echo $ limit;
Echo $ sidx;
Echo $ sord;
I don't know what the next two changes mean, so I want to output them.
Sale_list.html
JqGrid: powerful table plug-in application-Helloweba demonstration platform