• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Could not delete a single image from a model!![SOLVED]

#11
[eluser]Mizanur Islam Laskar[/eluser]
Well, I didn't quite get your point. But I removed '@' before unlink, but didn't get any good. Neighter get any error message.

#12
[eluser]mglinski[/eluser]
Code:
$picture = $row->picture;
unlink(realpath('assets/photo/'.$picture));
Try using those 2 lines in place of the current 2 lines.
-Matt

#13
[eluser]Référencement Google[/eluser]
I am not sure mysql_affected_rows() return something while using a DELETE query.
Also on this point, you should use CI's active record to make your test.

Secondly, it will we good for us to help you that you send the print_r($picture) result.
Also, in your code, there is an extra "." that should not be there: $picture .= $row->picture;

#14
[eluser]mglinski[/eluser]
Ok, I just took a good look at your code and its inherently flawed.
You are trying to read what you just deleted? Try this instead:
Code:
function delete_data($record_id)
{
    $query =  $this->db->get_where('projukti_committee',array('record_id' => $record_id));
    if( $query->num_rows() > 0 )
    {
        $row = $query->row();
        $picture = $row->picture;
        unlink(realpath('assets/photo/'.$picture));
        $this->db->delete('projukti_committee', array('record_id' => $record_id));
        return true;
    }
    return false;  
}

#15
[eluser]Mizanur Islam Laskar[/eluser]
Thank you very much Mr. XtraFile!!! It worked....wowwwwwww


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.