To enable this feature the public variable debug should be set to true.
When this variable is enabled a file named jqGrid.log is created in the directory where your script reside.
In order to ilustarte this we again will use our example.
There is no special requierment wheere to put the debug option. It should just be called after the grid is created.
Now the PHP code should look like this
<?php require_once 'jq-config.php'; // include the jqGrid Class require_once "php/jqGrid.php"; // include the PDO driver class require_once "php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Create the jqGrid instance $grid = new jqGrid($conn); // enable debugging $grid->debug = true; // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders'; $grid->dataType = "json"; $grid->queryGrid(); ?>
After runnig the html file a file jqGrid.log will be created with the following structure:
Executed 2 query(s) - 2010-02-13 16:39:34 Array ( [0] => Array ( [time] => 2010-02-13 16:39:34 [query] => SELECT COUNT(*) AS COUNT FROM orders [data] => [types] => [fields] => [primary] => [input] => ) [1] => Array ( [time] => 2010-02-13 16:39:34 [query] => SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders ORDER BY OrderID asc LIMIT 0, 10 [data] => [types] => [fields] => [primary] => [input] => ) )
This tell us that when the script is called two queries are executed.
Below we will explain every item in the query.