updating table

Questionsupdating table
cobalt asked 10 years ago

I want to achieve a result where I update any values at 'table1', this update will be reflected on 'table2' which share the same column name and value.

e.g I update 'table1' which has column name "Jan" that contains value "30". 'Table2' is also has column name "Jan" that contains value "10". Upon updating "Table1", the same update will go to "Table2" on column "Jan" which being changed/updated to value "30" .

Which features in phpgrid shall I use ?
I really need help from someone here.

Thanks.

3 Answers
Abu Ghufran answered 10 years ago

I am showing a sample usage code.

If you wish to update table2 when updating table1.
For the grid that is referring table1,
you can add update event handler that will update table2 data (along with it's update query)

// config for table 1 grid

$e["on_update"] = array("update_data", null, true);
$grid->set_events($e);

function update_client($data)
{
$str = "UPDATE table2 SET Jan='{$data["params"]["Jan"]}' WHERE client_id = {$data["client_id"]}";
mysql_query($str);
}

For more details, refer demos/editing/custom-events.php

cobalt answered 10 years ago

Still can't figure them out..help please

Abu Ghufran answered 10 years ago

I've emailed you the code sample.
Closing this ticket.

Your Answer

11 + 7 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?