I'm working on PostgeSQL with PHP and I know that PosrgeSQL allow columns of a table to be defined as arrays.
So let's say I have a table like this:
CREATE TABLE sal_emp (
a text ARRAY,
b text ARRAY,
c text ARRAY,
);
These are my arrays:
$a = array(aa,bb,cc);
$b = array(dd,dd,aa);
$c = array(bb,ff,ee);
and I want to insert them into respective column each like this:
a | b | c
-----------+------------+------------
{aa,bb,cc} | {dd,dd,aa} | {bb,ff,ee}
Can I insert it this way?
$a = implode(',', $a);
$b = implode(',', $b);
$c = implode(',', $c);
$a = array('a' => $a, 'b' => $b, 'c' => $c);
pg_insert($dbconn, 'table', $a);
Or is there a better way to achieve the same result?