updating related fields within 1 table

table_house
-id_house

table_cars
-id_cars
-id_house

table_drivers
-id_drivers
-id_cars
-id_house
-data

when I update field “data” in table_drivers I want all fields “data” in table_drivers where id_cars = ‘{id_cars}’ and id_house = ‘{id_house}’ to get the same update. I tried to use Ajax Event and update another table, but this isn’t working. My Grid should look like this:

id_driver id_cars id_house data
1 1 1 TeamRed (I will edit this and change to TeamYellow)
2 1 1 TeamRed
3 1 1 TeamRed

When I change TeamRed to TeamYellow where id_driver = 1 then I want all the other data to also update

id_driver id_cars id_house data
1 1 1 TeamYellow
2 1 1 TeamYellow (automatic update)
3 1 1 TeamYellow (automatic update)

Can anybody help me on this or give me a hint?

Re: updating related fields within 1 table

Try in (Form-)Event onAfterUpdate:

$sql = “Update table_drivers Set data = {data} WHERE (id_cars = {id_cars} AND id_house = {id_house})”;

sc_exec_sql($sql);

P.S.: please, rename field “data” to another name …

Re: updating related fields within 1 table

@RHS
I love you…saved me a lot of headaches…it worked but I needed quotes and also a reload of app so I can see changes…thanks to you it took me 5min…and I already tried a whole day to figure out a way…

$sql = “Update db_athletics_competition_results Set split_1_title = ‘{split_1_title}’ WHERE (id_competition = {id_competition} AND id_discipline = {id_discipline})”;
sc_exec_sql($sql);
sc_redir(form_db_athletics_competition_results.php)