Login   Register  
PHP Classes
elePHPant
Icontem

File: coco.db.php4

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Matthias Richter  >  phpMyCoCo  >  coco.db.php4  >  Download  
File: coco.db.php4
Role: ???
Content type: text/plain
Description: db access abstraction class
Class: phpMyCoCo
Author: By
Last change:
Date: 2001-03-11 13:42
Size: 735 bytes
 

Contents

Class file image Download
<?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;
    } 
  }

}
?>