[quote name='kenvogt' timestamp='1337903138' post='1956']
I have a mysql table with a column called 'updated'. It is of type datetime. I want this column updated automatically any time a row is updated. So I added the following callback and its associated function:
$crud->callback_before_update(array($this,'callback_update'));
...
function callback_update($post_array)
{
$post_array['updated'] = date('Y-m-d H:i:s');
return $post_array;
}
I have tried every format I can think of for setting the correct value of 'updated' but nothing is working. What should I be using in place of date('Y-m-d H:i:s')?
One other thing to note, 'updated' is listed in ->columns() but not in ->edit_fields().
[/quote]
You have to add the invisible type of field if the field is not at your form . So if you simply do something like:
$crud->fields('field1','field2','field4','updated');
$crud->change_field_type('updated','invisible');
it will work just fine...