Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Prepared statement problem
12-14-2011, 12:38 PM #1
- Join Date
- Nov 2011
- Thanked 0 Times in 0 Posts
Prepared statement problem
Well, i have a problem in prepared statement with 'bind_param'
My queries looks like this
$result = $db_connection->prepare("update users set date = ? where email= ?");
When i execute this, it gives error
Fatal error: Call to a member function bind_param() on a non-object in F:\xampp\htdocs\Login.php on line 21
12-14-2011, 04:37 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,660 Times in 2,629 Posts
Given the error you are missing a lot of code here.
This isn't the right way to use bind_param though. That should be
$result->bind_param("ss", $mysqlDateString, $email);. If $result is not an object as its complaining about here, this indicates that the prepare has failed. $db_connection appears to me to be a MySQLi object, otherwise the prepare would have fatal error on it as well.
You can try adding an error in there.
if ($result = $db_connection->prepare('...'))
printf('Error: %s', $db_connection->error);