PHP Classes

File: DBClassTest.php

Recommend this page to a friend!
  Classes of mgopicit   DBClass   DBClassTest.php   Download  
File: DBClassTest.php
Role: Example script
Content type: text/plain
Description: DBClassTest
Class: DBClass
Simple MySQL database access wrapper
Author: By
Last change:
Date: 15 years ago
Size: 735 bytes
 

Contents

Class file image Download
<?php
   
   
include("DBClass.php");
   
   
//To config. databse information
   
$con=new Database("localhost","database","username","password");

   
//To Connect the database
   
$con->connect();

   
// Assume BTable is Two column table [ Authour and Book ]
    // To get the rows from BTable
    // $rows - is a associate array
   
$rows = $con->getRows("Select * from BTable");

   
//To Connection Closed
   
$con->close();

   
// To Display the data
   
foreach ($rows as $row)
    {
        echo
$row["Author"];
        echo
$row["Book"];
    }
   
   
//To Connect the database
   
$con->connect();
   
   
//To inserted the data(s) into the table
   
$con->putRows("insert into BTable values('Name','Title')");
   
   
//To Connection Closed
   
$con->close();

?>