PHP Error Messages

From PustakaPedia
Jump to: navigation, search

Displaying Error Message

To display error message for troubleshooting, simply insert mysqli_error($yourconnectionvariable) after each query statement. This will display exactly the error type and which lines does it effect.
However, this error message display has to be removed once the function has gone live. This is because it can indicate line error to users using the function thus making the function vulnerable for hacking.

Types of Error Message

: syntax error, unexpected '...' (T_VARIABLE) in
Please check the commas, semicolons from the previous lines which may not be present

: mysqli_query() expects parameter 1 to be mysqli, null given in
Please check on the MySQLi connection, whether the variable '$con' has the correct spelling or not

Notice : Undefined variable: ... in .... on line ...
Please check on the variable declared on the line indicated, whether it was undefined earlier or there maybe duplication on the usage of the variable

Warning : mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in in .... on line ...
Please check on the table or field name where the result is intended to be stored

Notice: Undefined index: ... in ... on line ...
Please check on the field name whether it exists or not in table