LithMaster
04 Oct 2005, 09:51 PM
Hello everyone,I am running PHP 5 with Apache on Windows Pro XP, I have the following code and it keeps giving me errors, the code is for a MySQL 4.1 database connection system.
It keeps giving me the Error:
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in D:\PATH\DBConnectE.php on line 30
We could not query the database, please try again later,
SQL Connect Num=1
Line 30 is :echo(mysqli_error($this->Query)."<br /> We could not query the database, please try again later,<br /> SQL Connect Num=$this->DBConnectNum");
class DB
{
var $Conn;
var $DBConnectNum;
#var $Query;
function __construct($DBHost="localhost",$DBUsername="root",$DBPassword="****")
{
$this->DBConnectNum=1;
$this->Conn= mysqli_connect($DBHost,$DBUsername,$DBPassword) or die(mysqli_error($Conn)."<br />Database is not available at this moment, please try again later,<br /> SQL Connect Num=$DBConnectNum ");
$DBS= mysqli_select_db($this->Conn,"membersp") or die(mysqli_error($DBS)."<br />The required database is not available, please try again later,<br /> SQL Connect Num=$DBConnectNum");
return $this->Conn;
}
function SelectDB($DB)
{
$DBS= mysqli_select_db($this->Conn,$DB) or die(mysqli_error($DBS)."<br />The required database is not available, please try again later,<br /> SQL Connect Num=$DBConnectNum");
return $DBS;
}
function Query($SQL)
{
$this->Query=mysqli_query($this->Conn,$SQL);
if(!$this->Query)
{
echo(mysqli_error($this->Query)."<br /> We could not query the database, please try again later,<br /> SQL Connect Num=$this->DBConnectNum");
exit();
}
$this->DBConnectNum++;
}
function QueryInfo($Type="Array")
{
if($Type="Array")
{
$Array=mysqli_fetch_array($this->Query);
return $Array;
}
if($Type="NumRow")
{
$NumRow= mysqli_num_rows($this->Query);
return $NumRow;
}
}
function __destruct()
{
global $Conn;
mysqli_close($this->Conn);
}
}
Thanks in advance...
It keeps giving me the Error:
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in D:\PATH\DBConnectE.php on line 30
We could not query the database, please try again later,
SQL Connect Num=1
Line 30 is :echo(mysqli_error($this->Query)."<br /> We could not query the database, please try again later,<br /> SQL Connect Num=$this->DBConnectNum");
class DB
{
var $Conn;
var $DBConnectNum;
#var $Query;
function __construct($DBHost="localhost",$DBUsername="root",$DBPassword="****")
{
$this->DBConnectNum=1;
$this->Conn= mysqli_connect($DBHost,$DBUsername,$DBPassword) or die(mysqli_error($Conn)."<br />Database is not available at this moment, please try again later,<br /> SQL Connect Num=$DBConnectNum ");
$DBS= mysqli_select_db($this->Conn,"membersp") or die(mysqli_error($DBS)."<br />The required database is not available, please try again later,<br /> SQL Connect Num=$DBConnectNum");
return $this->Conn;
}
function SelectDB($DB)
{
$DBS= mysqli_select_db($this->Conn,$DB) or die(mysqli_error($DBS)."<br />The required database is not available, please try again later,<br /> SQL Connect Num=$DBConnectNum");
return $DBS;
}
function Query($SQL)
{
$this->Query=mysqli_query($this->Conn,$SQL);
if(!$this->Query)
{
echo(mysqli_error($this->Query)."<br /> We could not query the database, please try again later,<br /> SQL Connect Num=$this->DBConnectNum");
exit();
}
$this->DBConnectNum++;
}
function QueryInfo($Type="Array")
{
if($Type="Array")
{
$Array=mysqli_fetch_array($this->Query);
return $Array;
}
if($Type="NumRow")
{
$NumRow= mysqli_num_rows($this->Query);
return $NumRow;
}
}
function __destruct()
{
global $Conn;
mysqli_close($this->Conn);
}
}
Thanks in advance...