Code: Select all
<?php
class Db
{
var $dbh;
var $dbu;
var $dbp;
var $db;
var $query;
var $show;
function Db()
{
$this->dbh = NOT_SET;
$this->dbu = NOT_SET;
$this->dbp = NOT_SET;
$this->db = NOT_SET;
}
function Connect($dbh,$dbu,$dbp,$db)
{
@mysql_connect($dbh,$dbu,$dbp) or die("Database Connection Error!");
@mysql_select_db($db) or die("Database Selection Error!");
}
function Close()
{
mysql_close();
}
function Query($qry)
{
$this->query = @mysql_query($qry);
if(!$this->query)
{
echo "Query Error!";
}
}
function Result($no,$break="\n")
{
$this->show = mysql_fetch_array($this->query, MYSQL_NUM);
if(!$no)
{
$n = count($this->show);
for($i=0;$i<$n;$i++)
{
echo $this->show[$i].$break;
}
}
else
{
echo $this->show[$no];
}
}
}
?>All replies appreciated. Thank you, have a nice day