Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ismet Ozalp  >  Mysql Database Functions  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of the class
Class: Mysql Database Functions
MySQL wrapper to access data and manipulate tables
Author: By
Last change: Added Function Example
Date: 2006-04-04 13:10
Size: 1,621 bytes
 

Contents

Class file image Download
<link href="default.css" rel="stylesheet" type="text/css" />
<?
require_once("mysql.inc.php");
    
$connect = new MySQL_Func();
    
$connect->DB(); //Now Connected
    
$query "SELECT * FROM users";
    
$result $connect->query($query); //query example
    
echo "<CENTER>---Querying---</CENTER><BR>";
    while(
$dresult mysql_fetch_array($result,MYSQL_ASSOC)){
        
print_r($dresult);
        echo 
"<BR><BR>";
    }
    
//Numrows example
    
echo "<CENTER><BR><BR>---Get Number Of Rows---<BR><BR></CENTER>" $connect->numrows($query) . " Users exists!";
    
//Now Field Extractor
    
echo "<CENTER><BR><BR>---Field Extractor---<BR>(User ID:1) Username: " $connect->ex("$query WHERE USER_ID=1","USERNAME") . "<BR></CENTER>";
    echo 
"<CENTER><BR><BR>---Listing Fields Of The Table---<BR><BR></CENTER>";
    
$lfield $connect->list_fields($query,0);
    
print_r($lfield);
    echo 
"<CENTER><BR><BR>---Field Properties Of The Table---<BR><BR></CENTER>";
    
$pfield $connect->field_property("hostigen_cse305","users",0);
    
print_r($pfield);
    echo 
"<CENTER><BR><BR>---Listing Tables Of The Db---<BR><BR></CENTER>";
    
print_r($connect->list_tables("hostigen_cse305"));
    echo 
"<CENTER><BR><BR>---Optimizing Tables---<BR><BR></CENTER>";
    
$connect->optimize("hostigen_cse305");
    echo 
"<CENTER><BR><BR>---Listing Whole Table Into an Array---<BR><BR></CENTER>";
    
$table=$connect->listHoleTable("users");
    
print_r($table);
    echo 
"<BR><BR><BR>";
    echo 
"NEW FUNCTION getArray";
    echo 
"<BR><BR><BR>";
    
$newResult=$connect->getArray($query);
    
print_r($newResult);
    echo 
"<BR><BR><BR>";
    echo 
$newResult[0]["USERNAME"];
    
    
$connect->close();
?>