Jump to content

Insert Array into DB-postgres


ainoy31

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.