Paul Posted June 2, 2012 Share Posted June 2, 2012 Hi all, I have the following code that DW is telling me is incorrect syntax. $q = "INSERT INTO saved_curtains (user_id, fabric_drop, track_pole, track_pole_width, heading_tape, lining, fullness, interlined, fabric_width, final_curtain_quote, saved_date) VALUES ('$_SESSION['user_id']', '$curtain_list['fabric_drop']', '$curtain_list['track_pole']', '$curtain_list['track_pole_width']', '$curtain_list['heading_tape']', '$curtain_list['lining']', '$curtain_list['fullness']', '$curtain_list['interlined']', '$curtain_list['fabric_width']', '$curtain_list['final_curtain_quote']', NOW() ) "; I suspect it's something to do with all the quotes. I have tried changing the single quotes into double quotes every way I could and nothing seems to fix it. Any ideas? Cheers Paul Link to comment Share on other sites More sharing options...
bahaa Posted June 3, 2012 Share Posted June 3, 2012 Can we see the error you get when you run it? Link to comment Share on other sites More sharing options...
HartleySan Posted June 3, 2012 Share Posted June 3, 2012 The following should provide the necessary answers: http://stackoverflow.com/questions/7354554/using-php-variables-from-an-array-to-insert-into-sql-database-syntax-error Basically, you can use curly braces or concatenate a bunch of substrings together to get what you want. Link to comment Share on other sites More sharing options...
Recommended Posts