The below prepared statement has 5 variables.
INSERT INTO folder (folder_name, folder_parent_id, folder_user_id, folder_order, hk_created) VALUES (?,?,?,?,?);
I’m getting this warning when I call $_STATEMENT->bind_result( $_RESULT );
Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement
While obviously this is true ( 5 variables, 1 result variable ) an INSERT statement when executed only returns true (success) or false (failure). Just in case there were something I were missing, I tried providing 5 variables to bind_result() and I still got the same message.
The Insert query executes successfully. Should I just @suppress the warning and chalk this up as either a quirk or bug in PHP (sometimes I wonder if there is a difference) or is there something I’m missing?
Edited to reflect that I tried giving 5 variables to bind_result()
You can’t use
bind_resultwith anINSERTquery. It doesn’t have a result.$_STATEMENT->execute()will returnTRUEorFALSE. Use$_STATEMENT->affected_rowsif you want to see how many rows were inserted.