Sunday, 18 August 2013

mysqli prepared insert statement not functioning

mysqli prepared insert statement not functioning

I have just decided to alter all my queries to prepared statements. A
grueling task as I am sure you are aware. Anyway, I have an insert
statement that is just not functioning. Nothing is being inserted into the
table!
if($stmt = $mysqli->prepare("INSERT INTO session_id (ID, email,
session_ID) VALUES (?,?,?)")){
$stmt->bind_param('sss', $user_ID, $email, $session_id);
$stmt->execute();
setcookie('NBS_ID', $session_id , time()+3600*24*30,'/','');
$stmt->close();
}
I have tried testing for errors with $mysqli and $stmt but no error are
registering. I have manually entered the SQL into the table and it works
so I am completely baffled. What am I missing?

No comments:

Post a Comment