
25/08/2006, 10:28
|
| | Fecha de Ingreso: agosto-2006
Mensajes: 2
Antigüedad: 18 años, 6 meses Puntos: 0 | |
tengo dbconecction.php :
<?php
class DBConnection
{
var $Engine;
// public variables
var $ID;
var $LastErrorMessage = '';
var $LastErrorNumber = 0;
var $Persistent = 0;
// private variables
var $_Server;
var $_Username;
var $_Password;
var $_Database;
var $_State = 0;
function &DBConnection($server = null, $username = null, $password = null, $database = null, $persistent = 0)
{
$this->Engine = DB_DRIVER;
$this->Persistant = $persistent;
if (($server != null) && ($username != null) && ($database != null))
{
$this->Open($server, $username, $password, $database);
}
}
function Open($server, $username, $password, $database)
{
$this->_Server = $server;
$this->_Username = $username;
$this->_Password = $password;
$this->_Database = $database;
if ($this->Persistent == 1)
{
// open a persistent connection
$this->ID = @mssql_pconnect($this->_Server, $this->_Username, $this->_Password);
}
else
{
// open a normal connection
$this->ID = @mssql_connect($this->_Server, $this->_Username, $this->_Password);
}
if ($this->ID)
{
if (@mssql_select_db($this->_Database))
{
$this->_State = 1;
return true;
}
}
exit(sprintf(CU_ERR_DB_1000, mssql_get_last_message()));
}
function Close()
{
if ($this->_State)
{
@mssql_close($this->ID);
$this->_State = 0;
return true;
}
return false;
}
function State()
{
return $this->_State;
}
function Execute($SQL)
{
if ($this->_State)
{
if (!@mssql_query($SQL, $this->ID))
{
$this->LastErrorMessage = mssql_get_last_message($this->ID);
return false;
}
return true;
}
return false;
}
?> |