I’m trying to update a tuple in a table using php and sql via a website. Two of the attributes in the table are foreign keys that reference other tables.
$query="UPDATE store SET street='$street', city='$city', state='$state', zipcode='$zipcode', region_id='$region', manager_id='$manager' where id='$storeid'";
mysql_query($query) or die(mysql_error());
region_id and manager_id reference other tables and my query is failing as a result i think, because when i remove these two columns from the code then it executes fine.
how can i make this work? how do i make it so i can update this information and have it update the other two tables as well?
thanks for any suggestions and comments!
patrick
You will make it work when you provide values that are present in the referenced tables for the foreign key fields.