Location: PHPKode > scripts > GV RecordSet Class > gv-recordset-class/test.php
<?php

# ====================================================================
# =       This class are implemented only for MYSQL database         =
# =       Pay Attecion on the future updates, new DBMS will          =
# =                     be included on it.                           =
# =                                                                  =
# =                          Any questions, problems, report me!     =
# =											   hide@address.com		 =
# =                                                                  =
# =                					   Best Regards from Brazil!     =
# =											   			Sekiji.		 =													
# ====================================================================

# includes
include_once("class_Conection.php");
include_once("class_RecordSet.php");

# EXAMPLE SCRIPT - How to use the GV RecordSet Class
# The class was base on the ADO Record Set Logic.
# First we need to declare and create a conection object
$conn = new conection();

# Then we create a Recordset object, that needs the conection object as parameter
$rs = new RecordSet($conn);

# Now we make a SQL comand to bring what we need from de database.
$strSQL = "SELECT rep_str_texto FROM  replys";

# Open() method contains a sql comand as parameter.
$rs->open($strSQL);

# Finally all methods are ready to use.
$rs->bof; 							# ( Boolean ) Flag BOF : Begin of File.
$rs->eof; 							# ( Boolean ) Flag EOF : End of File. Boolean 
$rs->field("name of the field"); 	# ( String )	Call the current registerĀ“s Field by the name. 
$rs->field(1); 						# ( String )	You may also call the field by the number. Camuflated Polimorphism =).
$rs->first(); 						# ( Void ) Pointer now points to the first register.
$rs->last(); 						# ( Void ) Pointer now points to the last register.
$rs->next(); 						# ( Void ) Pointer to next register.
$rs->previous(); 					# ( Void ) Pointer to previous register.
$rs->count_registers(); 			# ( Integer ) Returns the total of fields that recordset contains.

# simple loop to show all registers
while(!$rs->eof){
	echo($rs->field("rep_str_texto") . "<BR>");
	$rs->next();
}

?>
Return current item: GV RecordSet Class