<?php
/*
*/
define("CALC_PERIOD",24*60*60);
class DBConnect
{
private $link=null;
private $db=null;
private $result=null;
private $primareyKeyField="userid";
private $dbtables=null;
private $dbfields=null;
function DBConnect($userid=" ----datebase user here---",$password="",$host="---- host name Here-----") ========>edit here host datebase user
{
$this->link=mysql_connect($host, $userid, $password) or die(mysql_error());
}
function setDatabase($db)
{
$this->db=$db;
mysql_select_db($this->db, $this->link) or die(mysql_error());
$tableSql="show tables from `".$this->db."`";
$res=mysql_query($tableSql, $this->link) or die(mysql_error());
while($row=mysql_fetch_row($res))
{
$this->dbtables[]=$row[0];
}
foreach($this->dbtables as $ind=>$table)
{
$defaultValueSql="show fields from `".$this->db."`.`".$table."`";
$res=mysql_query($defaultValueSql, $this->link) or die(mysql_error());
while($row=mysql_fetch_assoc($res))
{
$fldname=$row["Field"];
unset($row["Field"]);
$this->dbfields[$table][$fldname]=$row;
}
}
}