PHP Error Messages
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