|
When your projects do not work as expected, especially when you use a
load of events and custom code, you can use the following debugging
techniques to resolve the issue.
1. Print all executed SQL statements on the Web page
For this purpose set $dDebug
variable in include/dbcommon.php
file to true. Especially
useful when you need to resolve master-details or advanced security issues.
You can copy SQL query and run it against your database manually to
see if it returns correct results. To run SQL query manually use
tools that comes with your database (Query designer in MS Access,
Enterprise Manager in SQL Server, phpMyAdmin in MySQL).
2. Print out variables using echo statement
The echo command is used
to write output to a browser. The following example sends the text
"Hello World" to the browser:
echo "Hello World";
Here are several examples of how you can use echo command
echo "Variable name: " . $variable;
echo "field_name: " . $values["field_name"];
echo "UserID: " . $_SESSION["UserID"];
echo "Your IP address: " . $_SERVER['REMOTE_ADDR'];
|