| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Database |
JDatabase |
stderr |
stderr() |
Never | Work in Progress |
Returns the last database error message in a standard format. The error number and error message are included. The SQL statement that caused the error may optionally be included.
string stderr ( $showSQL )
| $showSQL | boolean | is a boolean value which if TRUE, displays the last SQL statement sent to the database. |
Example
$database =& JFactory::getDBO(); $query = "SELECT * FROM 'bad_table'"; $database->setQuery( $query ); $rows = $database->loadObjectList(); if ($database->getErrorNum()) { echo $database->stderr(); }
would produce:
Result
DB function failed with error number 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bad_table'' at line 1 SQL=SELECT * FROM 'bad_table'