asevie Posted March 23, 2013 Share Posted March 23, 2013 (edited) Fairly new to html, php etc. I can create rudimentary forms but now I'm trying to add multiple records at a time. How do I make the following a variable? I'd like to have this as my insert... $sql = "INSERT INTO `somedb` ( `ffid` , `email` , `sku`) VALUES ( $somenewvariable )"; Where $somenewvariable equals this; ' ', 'email1@gmail.com', '408'),(' ', 'email2@example.com', '400'),(' ', 'email3@example.com', '412' I'm missing something very basic, ie back slashes! The variable is turning into something like this; \'\', \'email1@gmail.com\', \'408\'), (\'\', \'email2@gmail.com\', \'400\' Edited March 23, 2013 by asevie Quote Link to comment https://forums.phpfreaks.com/topic/276050-phpmysql-insert-for-multiple-records/ Share on other sites More sharing options...
mac_gyver Posted March 23, 2013 Share Posted March 23, 2013 you must be escaping the actual query statement insted of just the data going into the query statement. the syntax of the query, quotes and such that you add around the data to produce the query, don't get escaped. Quote Link to comment https://forums.phpfreaks.com/topic/276050-phpmysql-insert-for-multiple-records/#findComment-1420519 Share on other sites More sharing options...
asevie Posted March 23, 2013 Author Share Posted March 23, 2013 (edited) you must be escaping the actual query statement insted of just the data going into the query statement. the syntax of the query, quotes and such that you add around the data to produce the query, don't get escaped. Thanks for the tip. Edited March 23, 2013 by asevie Quote Link to comment https://forums.phpfreaks.com/topic/276050-phpmysql-insert-for-multiple-records/#findComment-1420521 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.