I have a form which pulls a set of data from pg in a table format
eg:
Code: Select all
echo('<input type="text" name="id'. $row .'" value="' .$myrowї0] .'">');now what I want to do is this, use this calculated value to do an update query as follows
Code: Select all
<?php
$db = pg_connect("dbname=data_cc");
$id_chg="id'. $row .'";
$firstchg="$firstname'. $row .'";
$query = "UPDATE tb_contacts SET first_name='$firstchg' WHERE contact_id='$id_chg'";
$result = pg_exec($db, $query);
if (!$result) {
printf ("ERROR");
$errormessage = pg_errormessage($db);
echo $errormessage;
exit;
}
printf ("These values were updated in the database - ");
pg_close();
?>