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 '