Home > front end >  Easyui - the datagrid query to the data, but does not display the data, even without a header
Easyui - the datagrid query to the data, but does not display the data, even without a header

Time:10-01

The front-end HTML:


This is my js:

$(' # goods'). The datagrid ({
Url: 'index.php? A=admin& C=admin& M=goods_data ',
The Columns: [[
{field: "id", the title: 'own id, width: 50},
{field: 'cid, the title:' category ID ', width: 50},
{field: 'cname, title:' the name of the classification, width: 100},
{field: 'description, title, subtitle, width: 200},
{field: 'name', the title: "name of commodity, width: 300},
{field: 'sname, title:' goods details name, width: 400},
{field: 'ename, title:' foreign names, width: 400},
{field: 'original_price', the title: 'the pound price, width: 100},
{field: 'present_price', the title: 'the RMB price, width: 100},
{field: 'weight', the title: 'net content, width: 100},
{field: 'specs, title:' commodity specifications, width: 100},
{field: 'brand', the title: 'goods brand, width: 100},
{field: 'introuduction, title:' product introduction, width: 400},
{field: 'fname', the title: 'name', width: 150},
{field: 'faddress', the title: 'site', width: 150},
{field: fnum, title: 'telephone, width: 150},
{field: 'composition', the title: 'composition, width: 400},
{field: 'temperature', the title: 'temperature', width: 200},
{field: 'pd, title:' production date ', width: 100},
{field: 'Ed', the title: 'shelf life', width: 100},
{field: 'date', the title: 'creation date, width: 200},
{field: 'pic_path', the title: 'the booth chart path, width: 400},
{field: 'mygood_picture', the title: 'list figure path, width: 400},

]]
});

The corresponding PHP:

//commodity management
The function goods_data ()
{
$mysqli=new mysqli (' localhost ', 'shop', '123456', 'shop');
$mysqli - & gt; Utf8 set_charset (" ");
$SQL="SELECT * FROM goods";
{$data="https://bbs.csdn.net/topics/" rows ": ['.
If ($result=$mysqli - & gt; {$SQL query ())
While ($row=$result - & gt; Fetch_assoc ()) {
//print_r ($row);//can output
$date=strtotime ($row (" date "));
$date=date (" Y -m - d H: I: s ", $row (" date "));
$data.='{" id ":"'. $row [" id "]. '", "cid" : "'. $row [" cid "]. '", "cname" : "'. $row [" cname "]. '",
Description: "'. $row [" description"]. '", "name" : "'. $row [r]. "the name" '", "sname" : "'. $row [" sname "].
'", "ename" : "'. $row [" ename]. '", "original_price" : "'. $row [" original_price "] ", "
"Present_price" : "'. $row [" present_price"]. '", "weight" : "'. $row [r]. "weight" '", "specs" : "'. $row [" specs "].
, "
"Brand" : "'. $row [" brand"]. '", "introuduction" : "'. $row [" introuduction "]. '", "fname" : "'. $row [" fname "].
'", "faddress" : "'. $row [" faddress "] ", "
"Fnum" : "'. $row [" fnum"]. '", "composition" : "'. $row [" composition "]. '", "temperature" : "'
$row [" temperature "]. '", "pd" : ". $row [" pd "], "
"Ed" : "'. $row [" Ed"]. '", "pic_path" : "'. $row [" pic_path "]. '", "mygood_picture" : "'
$row [" mygood_picture "]. '", "date" : "'. $date. '"},';
}
//print_r ($data);//can output
$count=$mysqli - & gt; Affected_rows;
If ($count & gt; 0)
{
$data=https://bbs.csdn.net/topics/substr ($data, 0, 1);
}
$result - & gt; Close ();
}
$data.=']} ';

Echo $data;
}

Header and the data are not show, but the background you can see there is a echo data:


O great god teach
  • Related