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 Link to comment https://forums.phpfreaks.com/topic/83267-insert-array-into-db-postgres/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.