Fixed so that the php classes can run with out eny other class
This commit is contained in:
parent
0f5bfbdba9
commit
ff139b32bb
3 changed files with 87 additions and 54 deletions
79
db.php
79
db.php
|
|
@ -3,43 +3,64 @@
|
|||
$db_database = "";
|
||||
$db_user = "";
|
||||
$db_password = "";
|
||||
|
||||
|
||||
function dbconnect(){
|
||||
@mysql_pconnect($GLOBALS['db_host'],$GLOBALS['db_user'],$GLOBALS['db_password'])
|
||||
or die("ERROR CONNECTING TO DATABASE ".$GLOBALS['db_host']."!!!");
|
||||
@mysql_select_db($GLOBALS['db_database'])
|
||||
or die("THE DATABASE <b>".$GLOBALS['db_database']."</b> DO NOT EXIST!!!");
|
||||
}
|
||||
|
||||
function dbconnect(){
|
||||
@mysql_pconnect($GLOBALS['db_host'],$GLOBALS['db_user'],$GLOBALS['db_password'])
|
||||
or die("ERROR CONNECTING TO DATABASE ".$GLOBALS['db_host']."!!!");
|
||||
@mysql_select_db($GLOBALS['db_database'])
|
||||
or die("THE DATABASE <b>".$GLOBALS['db_database']."</b> DO NOT EXIST!!!");
|
||||
}
|
||||
|
||||
function dbdisconnect(){
|
||||
@mysql_close();
|
||||
}
|
||||
|
||||
function getTableRow($table, $id){
|
||||
function dbdisconnect(){
|
||||
@mysql_close();
|
||||
}
|
||||
|
||||
function getTableRow($table, $id){
|
||||
$sqlSats = "SELECT * FROM ".$table." WHERE id=".$id;
|
||||
return @mysql_fetch_assoc(runSimpleQuery($sqlSats));
|
||||
return runSimpleQuery($sqlSats);
|
||||
}
|
||||
|
||||
function getTableCount($table){
|
||||
$sqlSats = "SELECT * FROM ".$table;
|
||||
return @mysql_num_rows(runSimpleQuery($sqlSats));
|
||||
return runSimpleQuery($sqlSats);
|
||||
}
|
||||
|
||||
function runQueryArray($sqlSats){
|
||||
$resultat = array();
|
||||
$sql = @mysql_query($sqlSats)
|
||||
or die("QUERY FAILD!!!.");
|
||||
|
||||
while ($row = mysql_fetch_array($sql,MYSQL_ASSOC) ) array_push($resultat, $row);
|
||||
return $resultat;
|
||||
}
|
||||
|
||||
function runSimpleQuery($sqlSats){
|
||||
$resultat = @mysql_query($sqlSats)
|
||||
or die("QUERY FAILD!!!.");
|
||||
|
||||
return $resultat;
|
||||
}
|
||||
function getDBLastUpdateTime(){
|
||||
$query = runQueryArray("SHOW TABLE STATUS");
|
||||
foreach($query as $row){
|
||||
if(empty($ret) || $row["Update_time"] > $ret){
|
||||
$ret = $row["Update_time"];
|
||||
}
|
||||
}
|
||||
return date("D F o H:i",strtotime($ret));
|
||||
}
|
||||
|
||||
function dbSaveLog($url,$message,$date){
|
||||
runSimpleQuery("INSERT INTO log VALUES (null,'$url','$message','$date')");
|
||||
}
|
||||
|
||||
function runQueryArray($sqlSats){
|
||||
$resultat = array();
|
||||
$sql = @mysql_query($sqlSats);
|
||||
if($sql == false){
|
||||
trigger_error("ARRAY QUERY FAILD: \"".$sqlSats."\"", E_USER_ERROR);
|
||||
die();
|
||||
}
|
||||
while ($row = mysql_fetch_array($sql,MYSQL_ASSOC)){
|
||||
array_push($resultat, $row);
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
|
||||
function runSimpleQuery($sqlSats){
|
||||
$resultat = @mysql_query($sqlSats);
|
||||
if($resultat == false){
|
||||
trigger_error("QUERY FAILD: \"".$sqlSats."\"", E_USER_ERROR);
|
||||
die();
|
||||
}
|
||||
$temp = @mysql_fetch_assoc($resultat);
|
||||
return $temp;
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue