<?
class mysql_db_link {
/*
Class: db_link
Function: This class is intended to maintain simple connection information for your mysql db.
Author: Carter Comunale (carter@brasscity.com)
Date: 02/06/2000
Modified Last By: <your name here>
Modified Last Date: <your date here>
example usage: mysql_query($sql, $my_link->link())
*/
// Class Variables
var $database_name;
var $link;
var $errorno;
var $errmsg;
// class constructor
function mysql_db_link() {
$host = "localhost";
$database = "your_db_name";
$user = "your_user_name";
$password = "your_password";
$this->database_name = $database;
$this->link = mysql_pconnect ($host, $user, $password);
mysql_select_db ($database, $this->link);
$this->errno = mysql_errno($this->link);
$this->errmsg = mysql_error($this->link);
}
// simple accessors
function database_name() {
return $this->database_name;
}
function link(){
return $this->link;
}
function errorno(){
return $this->errorno;
}
function errmsg() {
return $this->errmsg;
}
}
?>
|