Jump to content

if sql was executed successfully... display message


centenial

Recommended Posts

[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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.