PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kami Knx  >  True MySQL class  >  index.php  >  Download  
File: index.php
Role: Class source
Content type: text/plain
Description: example
Class: True MySQL class
MySQL database access wrapper
Author: By
Last change: Fixed filename
Date: 7 years ago
Size: 917 bytes
 

Contents

Class file image Download
<?php

   
include "../db/class.db.php";
   
    class
User {
        private
$iduser;
        private
$user;
        private
$pass;
        private
$dt;
       
        public function
User() {
            echo
"<br />";
            echo
"-= Class User =- <br />";
            echo
"Name: " . $this->user . "<br />";
            echo
"Pass: " . $this->pass;
        }
    }
   
   
// Simple sample
   
$con = new DB();
   
$sql = "SELECT * FROM user";
   
$con->query($sql);
   
$con->getRow();
    echo
$con->getField("user") . "<br /><br />";
   
   
// Connection already open (2 or more queries)
   
$sql = "SELECT pass FROM user";
   
$rs = new DB($con->getCon());
   
$rs->query($sql);
   
$rs->getRow();
    echo
"User: " . $con->getField("user") . "<br />";
    echo
"Pass: " . $rs->getField("pass") . "<br />";
    echo
"<br />";
   
   
// Making objects with result
   
$sql = "SELECT * FROM user";
   
$con->query($sql);
   
$users = array();
    while (
$user = $con->getRowAsObj("User"))
       
$users[] = $user;

?>