Being a tyro, I'm sure I'm missing something obvious about handling the array $_POST. I hope wiser heads can point me in the right direction.

This fails:

$db = pg_connect( "dbname=foo user=bar" );

if( $db )
  print "Successfully connected to port: " . pg_port($db) ."<br/>\n";
} else {
  print pg_last_error ($db);

$res = pg_insert($db, 'vracore', $_POST);
if ($res) {
        echo "You're a Genius";
} else {
  print_r ($_POST);

pg_Close( $db );

The connection string works fine. If I insert each field in $_POST separately, that works fine too eg.


$query = "insert into foo (columnname1, columnname2, etc...) values ($value1, $value2, etc...);";

$result = pg_exec($db, $query);

But if I try pg_insert($db, 'foo', $_POST);

it fails. I note that print_r ($_POST) returns a list of values that includes [addentry] => Add Entry from the submit button. Is that what's screwing it up?

Any clues would be much appreciated.


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to