php - MySQLi: How to insert into multiple tables with prepared statements -
I am in a situation where I need to include two tables in a query. I searched around the web. And the solution could not be found. What do I want to do user
in the table & amp; Enter the value in profile
together other the way one after the other, but I have read that it is not efficient and considered as poor coding technique
Current code:.
$ statement = $ db- & gt; Ready ("start" `user` check (` username`, `email`,` password_hashed`, insert 'fname`, `lname`,` dob`, `agreement`,` gender`, `access_token`) values (, ,,,,,,,,); ???????? to enter `profile_picture` (` owner`) values (LAST_INSERT_ID ()); COMMIT, "); ($ Statement) {$ statement & gt; Bind_param ("ssssssiss", $ username, $ email, $ hashedPassword, $ fname, $ lname, $ date of birth, $ agreement, gender, $ ACCESS_TOKEN $); $ Statement & gt; Executed (); $ Statement & gt; near (); Echo "done"; Go out(); } And printf ("Error:% s. \ N", $ db-> Error);
, try using mysqli_multi_query, for example, check this link
Comments
Post a Comment