<?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, $password, true, "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
)
*/
?>
|