<?
/*
Classe Name: smysql (Simple Mysql)
Author.....: mArKitos
Date.......: 15/01/01
Description: smysql is a class which is aimed to be used fundamentally
as a base for the creation of other classes.
smysql serves the basic conection to mysql and a unique method
for the execution of the SQL sentences.
*/
class smysql {
var $DB_Name;
var $DB_User;
var $DB_Pass;
var $DB_Host;
var $DB_Link;
var $CM_TRUE = 1;
var $CM_FALSE = 0;
Function smysql ($Nombre_DB, $User_DB, $Pass_DB, $Host_DB){
$this->DB_Name = $Nombre_DB;
$this->DB_User = $User_DB;
$this->DB_Pass = $Pass_DB;
$this->DB_Host = $Host_DB;
return $this->CM_TRUE;
}
Function OpenConnection(){
$this->DB_Link = mysql_connect ("$this->DB_Host", "$this->DB_User", "$this->DB_Pass");
if (!$this->DB_Link){
return $this->CM_FALSE;
} else {
mysql_select_db ($this->DB_Name);
}
return $this -> CM_TRUE;
}
Function CloseConnection(){
if ($this->DB_Link){
mysql_close ($this->DB_Link);
}
return $this -> CM_TRUE;
}
Function ExecSQL ($Sql){
if (($Sql == '') || (strlen ($Sql)< 10) || (!$Sql)){
return $this->CM_FALSE;
}
$State = mysql_query ("$Sql", $this->DB_Link);
unset ($Sql);
return $State;
}
}
?> |