error in mysqli code
Posted: Sat Aug 28, 2010 12:19 pm
Hi, i don't really understand mysqli so i have put some code together and got an error but i have no idea how to solve it. Please could someone help?
This is the code,
This is the error,
This is the code,
Code: Select all
class DBConnection
{
private $_hostName;
private $_userName;
private $_userPassowrd;
private $_dbName;
private $_dbConnection;
private $_dbQuery;
public function __construct($hostName, $userName, $userPassword, $dbName)
{
$this->_hostName = $hostName;
$this->_userName = $userName;
$this->_userPassword = $userPassword;
$this->_dbName = $dbName;
}
public function connectToDB()
{
$this->_dbConnection = new mysqli($this->_hostName, $this->_userName, $this->_userPassword, $this->_dbName) or die();
return ($this->_dbConnection) ? true : false;
}
public function logInUser($userMail, $userPassword)
{
$tempResult = $this->_dbConnection->query("SELECT * FROM userDetails WHERE userMail='$userMail' AND userPassword='$userPassword'");
if ($tempResult)
return $tempResult->fetch_assoc();
else
return false;
}
}Fatal error: Call to a member function query() on a non-object in /homepages/38/d283760517/htdocs/GetBooking/UserSide/scripts/php/class/DBConnection.php on line 30