ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:recordset:movefirst

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
v5:reference:recordset:movefirst [2016/01/17 00:59]
mnewnham ↷ Page moved from v5:reference:movefirst to v5:reference:recordset:movefirst
v5:reference:recordset:movefirst [2020/01/02 16:50] (current)
peterdd
Line 6: Line 6:
 </​WRAP>​ </​WRAP>​
 ===== Description ===== ===== 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.+The function ''​moveFirst()''​ 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 ===== ===== Usage =====
Line 13: Line 13:
  * Connection to DB2 sample database  * Connection to DB2 sample database
  */  */
-$SQL = "​SELECT * FROM act" +$sql = "​SELECT * FROM act ORDER BY ACTNO ASC"; 
-$recordset = $db->​execute($SQL);+$recordset = $db->​execute($sql);
  
 /* /*
Line 20: Line 20:
  */  */
 $recordset->​move(9);​ $recordset->​move(9);​
-/* +$record = $recordset->​fetchObj(); 
- * Retrieve the record as an object +print_r($record);
- */ +
-$record = $recordset->​fetchObj;​+
  
 +$recordset->​moveFirst();​
 +$record = $recordset->​fetchObj();​
 print_r($record);​ 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 
-) 
-*/ 
 </​code>​ </​code>​
v5/reference/recordset/movefirst.1452988748.txt.gz · Last modified: 2017/04/21 11:37 (external edit)