This topic is locked
[SOLVED]

 updating record in another table

11/16/2007 1:18:23 PM
PHPRunner General questions
Allenh author

For some reason this code brings in a blank id from my user table (this is the key field - it is never NULL)
function AfterEdit(&$values, $where, &$oldvalues, &$keys,&$message,$inline)

{
global $conn,$strTableName;
$strSQLSave = "UPDATE `airhypen_cats`.`user_profile`

SET `user_accessgroup` = '".$values["accessgroup"]."',`employee_no` = '".$values["employee_no"]."',

`user_name` = '".$values["user_name"]."', `email_company` = '".$values["email"]."'

WHERE `user_access_id`='".$values["id"]."';

db_exec($strSQLSave,$conn);

return true;
gives this SQL:



UPDATE `airhypen_cats`.`user_profile` SET `user_accessgroup` = 'Webmaster',`employee_no` = '111', `user_name` = 'Porky', `email_company` = 'porky@air.ca' WHERE `user_access_id`=''

Any Thoughts?

A
alang 11/16/2007

Try using $keys["id"] instead of values["id"] in the WHERE clause.

Allenh author 11/18/2007