calculated form ID to new .php
Posted: Thu Mar 04, 2004 2:02 pm
What I am tryng to is this
I have a form which pulls a set of data from pg in a table format
eg:
where the value is concatenated with the row number value
now what I want to do is this, use this calculated value to do an update query as follows
Is what I am trying possible?
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();
?>