Wednesday, September 18, 2019
php - Issue with "Call to member function on non-object"
Answer
Answer
I'm not seeing the issue here...
Error: "Fatal error: Call to a member function bind_param() on a non-object in C:\wamp\www\In Progress\mtg\index.php on line 64"
$stmt = $mysqli -> prepare("INSERT INTO `" . $database . "`.`users` VALUES(NULL, ?, ?, 0);");
echo $mysqli -> error;
$stmt -> bind_param('ss', $username, $password);
$stmt -> execute();
$stmt -> close();
This is the offending block of code and the lines around it. The only thing I can think is that maybe $mysqli isn't being correctly defined in this one instance? $mysqli and $database are defined in a required file and all other functions that reference them for prepared statements work fine.
Is there something simple I'm missing here?
Answer
Your $stmt
is probably undefined because the previous line (prepare
) failed.
It's basically calling bind_param()
on a failed prepared statement, which happens to be an error or something.
hard drive - Leaving bad sectors in unformatted partition?
Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...
-
So I installed Ubuntu Netbook Remix 9.10 onto my Asus EeePC 1008HA netbook. It worked perfectly and was pretty quick. Restarting, suspending...
-
I tried adding grubx64.efi in the Windows Boot Manager using BCDEdit. However when I boot up my computer and try to start GRUB from Windows ...
-
Using Windows 7. When I RDP to a PC I'd like to be able to logout of the session without the screen reverting to a Ctrl+Alt+Del Login sc...
No comments:
Post a Comment