ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:recordset:movefirst

This is an old revision of the document!


moveFirst

Syntax
bool moveFirst()

Description

The function moveNext() moves the cursor to the first record in a recordset. The only time that the function returns false is if the recordset is empty.


Usage

/*
 * Connection to DB2 sample database
 */
$SQL = "SELECT * FROM act"
$recordset = $db->execute($SQL);
 
/*
 * Go to the 10th record
 */
$recordset->move(9);
/*
 * Retrieve the record as an object
 */
$record = $recordset->fetchObj;
 
print_r($record);
/*
 * Prints
ADOFetchObj Object
(
    [ACTNO] => 100
    [ACTKWD] => TEACH
    [ACTDESC] => TEACH CLASSES
)
*/
/*
 * Go to the 11th record
 */
$recordSet->moveNext();
/*
 * Retrieve the record as an object
 */
$record = $recordset->fetchObj;
 
print_r($record);
/*
 * Prints
ADOFetchObj Object
(
    [ACTNO] => 110
    [ACTKWD] => COURSE
    [ACTDESC] => DEVELOP COURSES
)
*/
v5/reference/recordset/movefirst.1452988748.txt.gz · Last modified: 2017/04/21 11:37 (external edit)