PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Radek Piekarz   Simple MySQL Class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Simple MySQL Class
Simple MySQL database access wrapper
Author: By
Last change:
Date: 18 years ago
Size: 717 bytes
 

Contents

Class file image Download
<?php
require_once('class.php');
#connecting to mysql server
$dbc = new dbconnect('localhost', 'root', 'password', 'database', __FILE__, __LINE__);


#using imple query and fetch_array method
$query = "SELECT field, field2 FROM table;";
$result = $dbc->query($pyt ,__FILE__, __LINE__);
while (
$record = $result->fetch_array())
{
    echo
$record['field'];
    echo
$record['field2'];
}

#using numr_rows()method
echo $result->num_rows();


#using query_bool method
if($dbc->query_bool("SELECT field, field2 FROM table;", __FILE__, __LINE__))
{
 
//CODE
}

#using first_cell method
echo $result->first_cell();


#changinh database
$dbc->change_base('database2', __FILE__, __LINE__);


?>