jqgrid表格报错

WBOY
Release: 2016-06-23 14:05:09
Original
1198 people have browsed it

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'payments' in 'field list'

<?phprequire_once '../../../jq-config.php';// include the jqGrid Classrequire_once ABSPATH."php/jqGrid.php";// include the driver classrequire_once ABSPATH."php/jqGridPdo.php";// Connection to the server$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);// Tell the db that we use utf-8$conn->query("SET NAMES utf8");// Create the jqGrid instance$grid = new jqGridRender($conn);// Write the SQL Query$grid->SelectCommand = 'SELECT id,order_id,payments-date FROM `sale_orders`';// set the ouput format to json$grid->dataType = 'json';// Let the grid create the model from SQL query$grid->setColModel();// Set the url from where we obtain the data$grid->setUrl('grid.php');// Set alternate background using altRows property$grid->setGridOptions(array(    "rowNum"=>10,    "sortname"=>"id",    "altRows"=>true,    "multiselect"=>true,    "rowList"=>array(10,20,50),    ));// Change some property of the field(s)$grid->setColProperty("id", array("label"=>"ID", "width"=>60));$grid->setColProperty("payments-date", array(    "formatter"=>"date",    "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y")    ));// Enjoy$grid->renderGrid('#grid','#pager',true, null, null, true,true);$conn = null;?>
Copy after login



回复讨论(解决方案)

字段名是 payments-date 吗?中间有减号?
`payments-date`

xuzuning大大:
       `payments-date`名称是这样的,中间有减号??那个报错是说字段名不对??

xuzuning大大,原来字段名称不能用中线,下划线就可以

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template