I am working on the back end php for a JQuery inline field editing feature for a web app.
I am passing the field name (id) and value (val) to the mysql/update method of my class.
Since this update can be for literally any field in the table (and therefore any property of the object), I need to be able to do this:
function update($id, $val) {
$this->$id = $val;
}
But I get "cannot access empty property" with this approach.
Using $id, which corresponds to one of the existing object properties, how can I assign $val to the correct property?