简体   繁体   中英

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?

Easy fix and I am sorry for bothering you with my stupidity on this. I had forgotten to close $stmt in a previous statement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM