Determining Whether an Item Exists in a Database
Before reading or setting an element in a database, it is sometimes useful to know whether the element exists. You can do this with the dba_exists() function, which requires the name of the element for which you are testing and a valid DBA resource. It returns true if the element exists:
if ( dba_exists("Tricorder", $dbh ) )
print dba_fetch( "Tricorder", $dbh );
|