Tuesday, August 9, 2011

PHP Debugging

How to debug errors in php without the errors on.

**************** Different ways to find Error ***************
1) Paste any of these codes after
<?php
echo "<pre>" ;
print_r($_REQUEST); die(); (b) error_reporting(1);
echo "<pre>" ;
print_r($_REQUEST); die();

2) Write these code to get the array output
         (a)print_r($variable_name);
           OR
        (b)var_dump($variable_name);  

Detail:   
First Check values, which are Posted to current form, by paste the (1) a or b code in your page at the top but after
"<?php "
Example:
echo "<pre>" ;
print_r($_REQUEST); die(); //your code...
It shows the post values only and not perform any other fucntion which is mentioned in current form.   
2ndly check all semicolons and check that you close all brackets.   
3rdly check includes files by comment them one by one or by "echo" Or "print_r" commands.   

Hope it will be help full. 
Regards   
Saleha A.Latif