Welcome Guest, Not a member yet? Register   Sign In
delete file and DB entry
#1

[eluser]Dregond Rahl[/eluser]
Code:
function delete_file($user, $delete_key)
    {
        $data = array();
            
        $this->db->where('user_name', $user);
        
        $this->db->where('delete_key', $delete_key);
        
        $query = $this->db->get('ed_files');

        if ($query->num_rows() > 0)
        {
            $data = $query->result_array();
        }
        
        if (unlink($data[0]['full_path']))
        {
            $this->db->where('user_name', $user);
            
            $this->db->where('delete_key', $delete_key);
            
            $this->db->delete('ed_files');
        }
        
        $query->free_result();
    }


There has got to be a better way of doing this and handling multiple files deletion. Anyone has any ideas? I greatly appreciate it


Messages In This Thread
delete file and DB entry - by El Forum - 06-01-2009, 11:01 AM
delete file and DB entry - by El Forum - 06-01-2009, 11:43 AM
delete file and DB entry - by El Forum - 06-01-2009, 04:22 PM
delete file and DB entry - by El Forum - 06-01-2009, 09:47 PM
delete file and DB entry - by El Forum - 08-14-2009, 09:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB