How to do a PHP query and display the MYSQL database error.
While (going to college / university) { we were never urged to display the mysql_error() results for queries if any existed. Mainly because you were expected to get your queries correct every single time; this was obviously not the case. Anyway, below is short and very simple code for displaying a mysql error result if any exists after the query is executed.};
//RUN QUERY $query = "INSERT INTO user (name) VALUES ('Jabba')"; $varquery = mysql_query( $query ); //DISPLAY CONDITIONAL RESULTS if ( $varquery ){ echo 'success'; } else { echo mysql_error(); }
Feel free to ask for help if you need it!
View More Tutorials
COMMENTS