class_mysql
Indigo/unused/class_mysql · 1.4 KB
From the archive indigo001.tgz
Download the archive « Back to the archive contents
<?
class db {
var $db_host = "localhost";
var $db_user = "muduser";
var $db_pwd = "mymud";
var $database = "mudgame";
var $connect_id;
var $row;
function db()
{
$this->db_host = $dbhost;
$this->db_pwd = $db_pwd;
$this->db_pwd = $db_pwd;
$this->db_base = $db_base;
$this->connect_id = mysql_connect($this->db_host, $this->db_user, $this->db_pwd);
if ( $this->connect_id )
{
$result = mysql_select_db( $this->database );
if (!$result)
{
@mysql_close($this->connect_id);
$this->connect_id=$result;
}
return $this->connect_id;
}
else
{
return 0;
}
}
function close()
{
$result=@mysql_close($this->connect_id);
return $result;
}
function query( $query = "" )
{
if( !empty( $query ) )
{
$this->result = @mysql_query( $query, $this->connect_id);
return $this->result;
}
}
function getrow()
{
$this->row = @mysql_fetch_array($this->result);
return $this->row;
}
function getobject()
{
$this->object = @mysql_fetch_object($this->result);
return $this->object;
}
function numrows()
{
/* Gets the number of rows returned in the query */
$result = @mysql_num_rows($this->result);
return $result;
}
};
?>