references:joomla.framework:database:jdatabase-geterrornumTable of Contents
getErrorNum
Returns the most recent database error code. See also JDatabase->stderr. Syntaxint getErrorNum () ExamplesExample $database =& JFactory::getDBO(); $query = "SELECT * FROM 'bad_table'"; $database->setQuery( $query ); $rows = $database->loadObjectList(); if ($database->getErrorNum()) { echo 'Error ' . $database->getErrorNum() . ': ' . $database->getErrorMsg(); } might produce: Result Error 1064: You have an error in your SQL syntax near \'\'bad_table\'\' at line 1 SQL=SELECT * FROM \'bad_table\' Discussion |


