Mysqli prepared insert statements always returning false

Posted by user1754679 on Stack Overflow See other posts from Stack Overflow or by user1754679
Published on 2012-10-17T22:59:24Z Indexed on 2012/10/17 23:00 UTC
Read the original article Hit count: 235

Filed under:
|
|

I'm writing prepared statements that are supposed to insert data into a table, on a database that's been pre-selected in the variable $GLOBALS['mysqli']. The connection has been tested, and that's not the problem I'm having. I'm only running into trouble whenever my prepared statement involves INSERT INTO. I know the tablename, and field names are correct, but $stmt is ALWAYS false. What gives?

$stmt = $GLOBALS['mysqli']->prepare("INSERT INTO audit_RefreshCount (user, count, lastrefresh) values (?,?,?)");
if ($stmt == TRUE) {
$stmt->bindParam('ssi', $_SESSION['username'], '0', time());
//$stmt->bind_Param('ssi', $_SESSION['username'], '0', time());     // Also doesn't work.
$stmt->execute();
}

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql