ainoy31 Posted December 26, 2007 Share Posted December 26, 2007 Hello- I have data that is in an array that I need to insert into my postgres DB. Here is my array data : foreach($comm as $key => $var) { $comm_htsus = "Commodity: " . $var . ', ' . ' ' . " HTSUS #: {$htsus[$key]}"; echo $commod_htsus . "<br>"; } This is what I have tried: $result = "INSERT INTO intl_quote VALUES(default, now(),'$date', '$c_name', '$c_contact', '$cphone', $commod_htsus)"; $sql = pg_query("$result"); It inserts fine, but if I have more than one element in the array, it only inserts the last one. Much appreciation. AM Quote Link to comment https://forums.phpfreaks.com/topic/83267-insert-array-into-db-postgres/ 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.