Jqgrid Report Error

Source: Internet
Author: User
Jqgrid form Error
SQLSTATE[42S22]: Column not found:1054 Unknown Column ' payments ' in ' field list '


Require_once '. /.. /.. /jq-config.php ';
Include the Jqgrid Class
Require_once Abspath. " Php/jqgrid.php ";
Include the driver class
Require_once Abspath. " Php/jqgridpdo.php ";
Connection to the server
$conn = new PDO (Db_dsn,db_user,db_password);
Tell the DB, 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" and "m/d/y")
)
);
Enjoy
$grid->rendergrid (' #grid ', ' #pager ', true, NULL, NULL, true,true);
$conn = null;
?>



------Solution--------------------
is the field name Payments-date? A minus sign in the middle?
' Payments-date '
  • 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.