<?php
// this class *requires* conf.vars.php
class cocoDB
{
var $link;
function db_connect()
{
global $COCO_CONF_VARS;
if($this->link = mysql_connect
($COCO_CONF_VARS[DBHOST],$COCO_CONF_VARS[DBUSER],$COCO_CONF_VARS[DBPASS]))
{
if(mysql_select_db($COCO_CONF_VARS[DBNAME],$this->link))
{
return;
}
}
}
function db_query($query)
{
$answer = mysql_query($query,$this->link);
return $answer;
}
function db_insert_id()
{
$id = mysql_insert_id($this->link);
return $id;
}
function db_fetch_array($answer)
{
if($result = mysql_fetch_array($answer))
{
return $result;
}
}
}
?>
|