Login   Register  
PHP Classes
elePHPant
Icontem

File: mysql_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jeremy Stansfield  >  mysqlRecordSet  >  mysql_example.php  >  Download  
File: mysql_example.php
Role: Example script
Content type: text/plain
Description: small example script, for using record set object
Class: mysqlRecordSet
Creates MySQL connection and record set objects
Author: By
Last change: added mysql object declaration
Date: 2003-05-07 15:57
Size: 529 bytes
 

Contents

Class file image Download
<? 
// make sure you set the global variables in the mysql.php file
include "mysql.php";
$db = new mysql_access(MYSQL_DB,MYSQL_SERVER,MYSQL_USER,MYSQL_PASS);
// this returns a record set
$rsObj RS("SELECT `name`,`description` FROM `people`");
while(!
$rsObj->eof) { // while not at end of file (end of record set)
    
echo $rsObj->field['name']."<br>&nbsp;&nbsp;".$rsObj->field['description']; // echo results
    
$rsObj->move_next(); // move to the next record
}
$rsObj->free(); // free the result set from memory



?>