[WORKING] mosDBTable->getError

Last reviewed: Not reviewed


Returns the most recent error message.


string getError ( )


Example: This example uses the myTable class defined on the mosDBTable class overview page. The error message shown here results from not having created the jos_myTable table.

global $database;
// Declare an instance of the myTable class.
$myTbl = new myTable( $database );
// Try to delete a record from the table.
$uid = 17;
if (!$myTbl->delete( $uid )) {
  echo str_replace( array( '\n', "\'" ), array( '', "'" ), $myTbl->getError() );
  echo "\n";

which might output:

Table 'test.jos_myTable' doesn't exist SQL=DELETE FROM jos_myTable WHERE id = '17'

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

Last Updated ( Monday, 25 December 2006 )