i have this function
function c_del()
{
$session_data = $this->session->userdata('logged_in');
$uname = $session_data['username'];
$query = $this->user_m->viewDetail($uname);
foreach($query as $row)
{
$username=$row->username;
}
$id_calon_reg=$_GET['a'];
$query1 = $this->candidate_m->del_calon($id_calon_reg);
$query3 = $this->candidate_m->search_calon($id_calon_reg);
foreach($query3 as $row)
{
$foto_calon=$row->foto_calon;
}
unlink($foto_calon);
$query2 = $this->candidate_m->viewAll();
$data=array(
"query"=>$query2,
"username"=>$username
);
$this->load->helper(array('form'));
$this->load->view('candidate_view',$data);
}
i want to unlink the path stored in $foto_calon, but i get this error
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: foto_calon
Filename: controllers/candidate.php
Line Number: 67
line 67 is where i call unlink function.
but I already define the variable $foto_calon in foreach.
the first foreach when i want to store the username into $username its success but got error in the second foreach.
i can't find out what's the problem. can anybody tell me?