aej1973
asked on
mysqli error...
Hi, I am running this query and I keep get the following error, can someone let me know what is wrong here?
Warning: mysqli::prepare(): Couldn't fetch mysqli in /var/www/voicebox/home_use r.php on line 87
Fatal error: Call to a member function bind_param() on a non-object in /var/www/voicebox/home_use r.php on line 88
Warning: mysqli::prepare(): Couldn't fetch mysqli in /var/www/voicebox/home_use
Fatal error: Call to a member function bind_param() on a non-object in /var/www/voicebox/home_use
$ph=$mysqli->prepare("select did_number from did_numbers where assigned_to=? and did_status='1'");
$ph->bind_param("i",$userid);
$ph->execute();
$ph->fetch();
$ph ->store_result();
$phCount=$ph->num_rows;
if($phCount==0)
$rowCount="No Lines";
else {
$rowCount=$phCount;
}
Do you have code to open the connection on that page before those lines? http://us3.php.net/manual/en/mysqli.construct.php
ASKER
yes, the connection is open..
See the first user comment here http://php.net/manual/en/mysqli.query.php about "Couldn't fetch mysqli".
ASKER
ok, let me check.
You may also be missing a statement according to the example here: http://www.php.net/manual/en/mysqli.prepare.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Marcus, this is the error I am getting...
Fatal error: Call to undefined method mysqli::error() in /var/www/voicebox/home_use r.php on line 92
Fatal error: Call to undefined method mysqli::error() in /var/www/voicebox/home_use
ASKER
solved. Thanks Marcus.
if ($ph == false){
die($mysqli->error);
}
if ($ph == false){
die($mysqli->error);
}
$sqlstr="select did_number from did_numbers where assigned_to=? and did_status='1'";
echo $sqlstr . "</br>";
exit;
mysqli->prepare("select did_number from did_numbers where assigned_to=? and did_status='1'");