PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of sifat kabir   Simple and small DB class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: uses
Class: Simple and small DB class
Access to a MySQL database using a singleton
Author: By
Last change:
Date: 13 years ago
Size: 462 bytes
 

Contents

Class file image Download
<?php
include 'db.php';
$db=DB::getInstance();

//returns all table name in array
$tables = $db->assoc_arr("SHOW TABLES");
//print_r($tables);

//function thats drop table

function drop($table_name)
{
    global
$db;
    if(
$db->query("DROP TABLE `$table_name`")===TRUE)
    {
        return
TRUE;
    }
    else
    {
        return
FALSE;
    }
}

// get number of rows
$num=$db->num_rows("select * from schedule where date='$today' and time='$time'");
print_r($num);