Difference between revisions of "PHP Error Messages"

From PustakaPedia
Jump to: navigation, search
(Displaying Error Message)
(Types of Error Message)
Line 12: Line 12:
  
 
''':  Undefined variable: ... in .... on line ...''' <br/>
 
''':  Undefined variable: ... in .... on line ...''' <br/>
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
+
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<br/><br/>
 +
 
 +
'''Warning :  mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in  in .... on line ...''' <br/>
 +
Please check on the table or field name where the result is intended to be stored

Revision as of 11:29, 18 February 2019

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

: 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