1
0
Fork 0
This commit is contained in:
Ziver Koc 2008-11-14 16:38:36 +00:00
commit 20496a4be0
6 changed files with 310 additions and 0 deletions

45
db.php Normal file
View file

@ -0,0 +1,45 @@
<?php
$db_host = "koc.se";
$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 dbdisconnect(){
@mysql_close();
}
function getTableRow($table, $id){
$sqlSats = "SELECT * FROM ".$table." WHERE id=".$id;
return @mysql_fetch_assoc(runSimpleQuery($sqlSats));
}
function getTableCount($table){
$sqlSats = "SELECT * FROM ".$table;
return @mysql_num_rows(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;
}
?>