1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 4 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Developer Manual arrow 11. API Reference arrow [REVIEW] database->stderr

[REVIEW] database->stderr PDF Print E-mail

Last reviewed: Not reviewed
phpDocumentor

database->stderr

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.

Syntax

string stderr ( [ boolean $showSQL ] )

$showSQL
is a flag.  If true then the error message will include the SQL statement that caused the error; otherwise the SQL statement will be omitted.  This parameter is optional and if omitted will default to false.

Examples

Example:

$query = "SELECT * FROM 'bad_table'";
$database->setQuery( $query );
$rows = $database->loadObjectList();
if ($database->getErrorNum()) {
  echo $database->stderr();
}

which would output:

DB function failed with error number 1064<br />
<font color="red">You have an error in your SQL syntax
          near ''bad_table'' at line 1 SQL=SELECT * FROM 'bad_table'</font>
 

which would render as:

DB function failed with error number 1064
You have an error in your SQL syntax near ''bad_table'' at line 1 SQL=SELECT * FROM 'bad_table'

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Monday, 25 December 2006 )
 
< Prev   Next >