
Untitled
By: a guest on
Apr 25th, 2012 | syntax:
None | size: 0.47 KB | hits: 13 | expires: Never
How to update but if field is empty not
if ($this->data['file'] == "") {
unset($this->data['file']);
}
$update['description'] = $_POST['description']; //just another field
if($_POST['file']['name'] == "") //check if there's a new file
$update['filename'] = $this->book->file_name; //current file name
else
$update['filename'] = $_POST['file']['name']; //new file name in case the user uploaded a new file
$this->book->update($update); //update no matter what