Login   Register  
PHP Classes
elePHPant
Icontem

File: example

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andreas Popadopolous  >  Database Connection  >  example  >  Download  
File: example
Role: Example script
Content type: text/plain
Description: example file
Class: Database Connection
Simple MySQL database access wrapper
Author: By
Last change:
Date: 2006-03-02 06:48
Size: 1,326 bytes
 

Contents

Class file image Download
<?php
// Make sre the varaiable settings are correct in dbConn.data.inc.php
require_once ('dbConn.class.php');        // Gimme the Class
$objConn= new dbConn;                                    // New Instance
$objConn->setpersistent(false);                // Defaults to false
$objConn->openConn();                                    // Open connection

/* ***************************************************************************** */
$query 'SELECT 1';                                        // Create the query
//$objConn->openQuery($query);                        // 
$result $objConn->openQuery($query);    // Run the query & Assign the result to your local variable
//echo mysql_num_fields($result );                // now you are free to use it as a regular result set

$row_RecordsetMain mysql_fetch_array($result);
echo 
'1st:'.$row_RecordsetMain[1].'<br/>';
/* ***************************************************************************** */
$objConn->freeReuslt();                                    // you can free the result and still use the recordset (but why would you?
$query 'SELECT 2';                                        // Create the query
$result2 $objConn->openQuery($query);
$row_RecordsetMain2 mysql_fetch_array($result2);

echo 
'1st again:'.$row_RecordsetMain[0].'<br/>';
echo 
'2nd:'.$row_RecordsetMain2[0].'<br/>';

//$objConn->freeReuslt(); // Close the result set
$objConn->closeConn();     // This will do nothing if the connection is persistent
?>