sylvest Posted May 21, 2017 Share Posted May 21, 2017 I have the following SQL being executed by a mysqli_query() statement in my PHP code: DROP TEMPORARY TABLE IF EXISTS tmptable; CREATE TEMPORARY TABLE tmptable SELECT * FROM Members WHERE MemberId = '105' AND Status > '0'; UPDATE tmptable SET RecordId = '', Status = '0', ChangedBy = '4', ChangedOn = '2017-05-21 19:03:39'; UPDATE Members SET Status = '0' WHERE MemberId = '105' AND Status > '0'; INSERT INTO Members SELECT * FROM tmptable; It is being rejected with the following error: Errno: 1064 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TEMPORARY TABLE tmptable SELECT * FROM Members WHERE MemberId = '105' AND' at line 1 at line 952 in file: /home/sylvest/public_html/swchoir/edit_member.php If I put the same SQL into the SQL tab in phpMyAdmin, it works fine. What do I have to do to make this work in my PHP code? Thanks - Rowan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.