ADOdb have features that help finishing your work faster. A good feature is advance select. You can improve code writing by using advance select in ADOdb.
Simple Select
This is simple select in ADOdb
include('adodb.inc.php'); # load code common to ADOdb
$conn = &ADONewConnection('access'); # create a connection
$conn->PConnect('northwind'); # connect to MS-Access, northwind DSN
$recordSet = &$conn->Execute('select * from products');
if (!$recordSet)
print $conn->ErrorMsg();
else
while (!$recordSet->EOF) {
print $recordSet->fields[0].' '.$recordSet->fields[1].'
';
$recordSet->MoveNext();
} $recordSet->Close(); # optional
$conn->Close(); # optional
Select Limit
The formula is:
SelectLimit($sql,$numrows=-1,$offset=-1,$inputarr=false)
Returns a recordset if successful. Returns false otherwise. Performs a select statement, simulating PostgreSQL's SELECT statement, LIMIT $numrows OFFSET $offset clause.
For example
$connection->SelectLimit('SELECT * FROM TABLE',-1,10)
RecordCount()
Returns the number of rows in the record set. If the number of records returned cannot be determined from the database driver API, we will buffer all rows and return a count of the rows after all the records have been retrieved. This buffering can be disabled (for performance reasons) by setting the global variable $ADODB_COUNTRECS = false. When disabled, RecordCount( ) will return -1 for certain databases
$rs = &$conn->Execute('select * from products');
$total = $rs->RecordCount();