asevie Posted March 23, 2013 Share Posted March 23, 2013 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'),(' ', '[email protected]', '400'),(' ', '[email protected]', '412' I'm missing something very basic, ie back slashes! The variable is turning into something like this; \'\', \'[email protected]\', \'408\'), (\'\', \'[email protected]\', \'400\' 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. 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 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. 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
Archived
This topic is now archived and is closed to further replies.