This topic is locked

how to update tables underlying a view

3/30/2007 11:52:39 PM
PHPRunner General questions
D
dlpirl author

I want to use dependant fields that are actually lookup IDs to other tables. Because dependant fields need to be in one table, I've created a view that includes the dependant fields. However, a limitation of MySQL is that underlying tables are not updated when a record in the view is updated. I understand there is a way I can edit the php code to that the underlying tables are updated. Can some one please point me in the right direction as to how this is done?

Alexey admin 4/2/2007

Hi,
use Before recod updated event for this.

Here is the sample code:

global $conn;

$sql = "update table2 set field2=".$values["field2"]." where ...";

db_exec($sql,$conn);

unset($values["field2"]);



unset statement is required to exclude field2 from main view update command.