mixed getOne( string $sql )
Executes the SQL and returns the first column of the first row. The recordset and remaining rows are discarded for you automatically. If an error occurs, either false or null is returned depending on the value of $ADODB_GETONE_EOF.
You can use errorMsg() to get any the error details.
By default, getOne returns NULL if no records are found. The global variable
$ADODB_GETONE_EOF can be set to any value to indicate no match
$ADODB_GETONE_EOF = "-1"; $SQL = "SELECT MAX(tickets) FROM arena WHERE zip_code = '80111'"; $maxTickets = $db->GetOne($SQL); if ($maxTickets == -1) print "There are no arenas in zip code 80111"; elseif ($maxTickets == 0) print "No tickets have been sold in zip code 80111"; else print "The maximum number of tickets sold by arenas in Zip Code 80111 is $maxTickets";