Db error: Difference between revisions From Online Manual

Jump to: navigation, search
(Created page with "{{smcfunc |function=db_error |usage=$smcFunc['db_error'] (connection) |description=Will return the exact same results as [http://php.net/mysql_error mysql_error]. |parameters={{p...")
 
m (refresh SMW properties)
 
(One intermediate revision by one other user not shown)
Line 11: Line 11:
@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.');</nowiki>
@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.');</nowiki>
}}
}}
<noinclude>
<noinclude>
[[Category:Database Functions]]
[[Category:Database Functions]]</noinclude>
[[Category:2.0]]
[[Category:Customizing SMF]]
[[Category:Developing SMF]]</noinclude>

Latest revision as of 16:40, 11 October 2012

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: