Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    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

    PHP Code:
    $db_connection->prepare("update users set date = ? where email= ?");

    Here $mysqlDateString is the date variable
    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
    Here what should be the variable type of date. I have tried many things but nothing works.

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,662 Times in 2,631 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.
    PHP Code:
    if ($result $db_connection->prepare('...'))
    // ...
    printf('Error: %s'$db_connection->error);


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts