centenial Posted June 10, 2006 Share Posted June 10, 2006 Is there a way to do this?If MySQL query was executed successfully - Display success message.Else... Display error message.There must be an easy way to do this, but I don't know how to tell the script if the query was executed successfully.Please help? Link to comment https://forums.phpfreaks.com/topic/11670-if-sql-was-executed-successfully-display-message/ Share on other sites More sharing options...
poirot Posted June 10, 2006 Share Posted June 10, 2006 [code]$sql = "SELECT something FROM sometable";$result = mysql_query($query);if ($result === false) { echo 'Error: ' .mysql_error();} else { echo 'Success';}[/code][!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_query() returns a resource on success, and FALSE on error. For other type of SQL statements, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success and FALSE on error. [/quote] Link to comment https://forums.phpfreaks.com/topic/11670-if-sql-was-executed-successfully-display-message/#findComment-44122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.