Hi,
See my code below. When I edit and save the record, my field is not modified.
Can you please help? thanks
$g = new jqgrid();
// set few params
$grid["shrinkToFit"] = false;
$grid["autowidth"] = true; // expand grid to screen width
$g->set_options($grid);
$e["on_update"] = array("update_client", null, true);
$g->set_events($e);
function update_client($data)
{
$str = "UPDATE p_ozone SET modifier='foo'
WHERE id = {$data["id"]}";
mysql_query($str);
}
what I am trying to do is when any field is updated I want another field updated to be updated with a variable from my code. In the above example I am trying to update the field with text 'foo'
Your code looks fine. Check that first column name is 'id'. If not, change it to first column name.
You can always check what comes in $data array using:
function update_client($data)
{
// this would show $data in error msg.
ob_start();
print_r($data);
phpgrid_error(ob_get_clean());
$str = "UPDATE p_ozone SET modifier='foo'
WHERE id = {$data["id"]}";
mysql_query($str);
}