I want to Gives for Fb_image value 0 only if user changed his profile picture.
if just pressed save settings for something like full name without changing picture it stays same of database.
In this code fb_image = 0even if user didn’t change the picture.
// upload users image
$filename_image = null;
if(! empty($_FILES['image']['name']) ) // if image
{
$file_image = array('folder'=>'users/images', 'input_file'=>'image');
// update users image
$filename_image = $this->file_uploads->upload_file($file_image, 512, 512, 256, 256);
// through image upload error
if(!empty($filename_image['error']))
$this->form_validation->set_rules('image_error', lang('common_image'), 'required', array('required'=>$filename_image['error']));
}
if ($this->form_validation->run() === TRUE)
{
// save the changes
$data = array();
// upload image only if selected
if(!empty($filename_image) && !isset($filename_image['error']))
$data['image'] = $filename_image;
$data['fb_image'] = 0 ;
$data['fullname'] = $this->input->post('fullname');
$data['email'] = $this->input->post('email');
$data['username'] = $this->input->post('username');
$data['gender'] = $this->input->post('gender');
$data['notifications'] = isset($_POST['notifications']) ? 1 : 0;
$data['apppear_search'] = isset($_POST['apppear_search']) ? 1 : 0;
$data['anonymous_posts'] = isset($_POST['anonymous_posts']) ? 1 : 0;