#native_company# #native_desc#
#native_cta#

Connect to Mysql and select db

By George Kosmidis
on December 4, 2002

Version: 1.1.0

Type: Class

Category: Databases

License: GNU Library Public License

Description: a Class for OO programing to connect to mysql and select a specific db

<?php
/*************************************************
Title			: Connect to MySQL and Select db
File			: mysql.cls.php
Version			: 1.1.0
Last Edit		: 02.12.2002 - 14:09:00
Developer		: George Kosmidis
***************************************************/

//clMySQL->clMySQL_setUrl("THE_URL"); if not set default is localhost
//clMySQL->clMySQL_setUser("USERNAME");
//clMySQL->clMySQL_setPass("PASSWORD");
//clMySQL->clMySQL_setCon("[persistant|simple]"); if not set default is simple
//clMySQL->clMySQL_selDB("DATABASE_NAME");

class clMySQL {

	var $url="localhost";
	var $user;
	var $pass;
	var $con="simple";
	var $selDB;

	function clMySQL_setUrl($newUrl){$this->url=$newUrl;}
	function clMySQL_setUser($newUser){$this->user=$newUser;}
	function clMySQL_setPass($newPass){$this->pass=$newPass;}
	function clMySQL_setCon($newCon){$this->con=$newCon;}
	function clMySQL_setSelDB($newSelDB){$this->selDB=$newSelDB;}

	function clMySQL_getUrl(){Return $this->url;}
	function clMySQL_getUser(){Return $this->user;}
	function clMySQL_getPass(){Return $this->pass;}
	function clMySQL_getCon(){Return $this->con;}
	function clMySQL_getSelDB(){Return $this->selDB;}

	function clMySQL_DoCon(){
		if($this->clMySQL_getCon()=="simple") {
			$db=mysql_connect($this->clMySQL_getUrl(),$this->clMySQL_getUser(),$this->clMySQL_getPass());
		}
		elseif($this->clMySQL_getCon()=="persistant") {
			$db=mysql_pconnect($this->clMySQL_getUrl(),$this->clMySQL_getUser(),$this->clMySQL_getPass());
		}
	}

	function clMySQL_SelDB(){
		mysql_select_db($this->clMySQL_getSelDB());	
	}

}
?>