45 lines
No EOL
1.3 KiB
PHP
45 lines
No EOL
1.3 KiB
PHP
<?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;
|
|
}
|
|
|
|
?>
|