This topic is locked

update in event

10/20/2008 5:30:58 PM
PHPRunner General questions
F
frphilip author

Hi,
In an edit_page, I want to add an event to update an other table.
1 - find the value of one field in the form named : value_userID

2 - find the value of editid1 field

3 - Build the query

4 - send the query

//********** Insert a record into another table ************

global $conn;

$user=$values['value_userID'];

$contactID=$values['editid1'];

$req = "update echange set userID='$user' where contactID='$contactID'";

$res=mysql_query($req);


Well, no error produced, but no update ! I think I've not the good method to get the values of the fields in the form.
Wasn't it an array $value() wich contain the values ?

J
Jane 10/22/2008

Hi,
$values array contains all field values entered on the page: $values["FieldName1"], $values["FieldName2"], etc.

Key values are stored in the $keys array: $keys["KeyFieldName"].

See my corrections in Bold:

global $conn;

$user=$values["userID"];

$contactID=$keys["KeyFieldName"];

$req = "update echange set userID='".$user."' where contactID='".$contactID."'";

$res=mysql_query($req);



Please note field names are case sensitive here.