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 Peter Pivarc  >  MySQL DB Handler  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example of usage
Class: MySQL DB Handler
Execute MySQL database queries
Author: By
Last change:
Date: 2009-12-06 04:50
Size: 966 bytes
 

Contents

Class file image Download
<?php 
/*
 * define connection parameters
 */
$server "localhost";
$username "db_user";
$password "testPWD";
$database "main_db";

/*
 * create sql query
 */
$sql "select * from users limit 0,1 25";

/*
 * include database class
 */
require_once("db.mysql.php");

/*
 * create instance of db class
 */
$db = new database($server$database$username$passwordtrue"dberr.log");

/*
 * select data from database
 */
$ret $db->select($sql);

/*
 * print data
 */
print_r($ret);

/*
 * will return:
 * Array
(
    [id] => Array
        (
            [0] => 1
        )

    [name] => Array
        (
            [0] => System
        )

    [surname] => Array
        (
            [0] => Administrator
        )

    [login] => Array
        (
            [0] => admin
        )

    [pass] => Array
        (
            [0] => admin_pwd
        )

    [__num_records] => 1
)

 */
?>