db_error From Online Manual

Revision as of 21:48, 8 October 2012 by Emanuele (talk | contribs)
Jump to: navigation, search

Usage:

$smcFunc['db_error'] (connection)


Description: Will return the exact same results as mysql_error.

Parameters:

  • connection the database connection.

Return: a text of the last occurred error or an empty string if no error occurred.

Example:

// Language files aren't loaded yet :(.
$db_error = @$smcFunc['db_error']($db_connection);
@mail($webmaster_email, $mbname . ': SMF Database Error!', 'There has been a problem with the database!' . ($db_error == '' ? '' : "\n" . $smcFunc['db_title'] . ' reported:' . "\n" . $db_error) . "\n\n" . 'This is a notice email to let you know that SMF could not connect to the database, contact your host if this continues.');



Advertisement: