CodeIgniter Forums
Could not delete a single image from a model!![SOLVED] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Could not delete a single image from a model!![SOLVED] (/showthread.php?tid=10696)

Pages: 1 2


Could not delete a single image from a model!![SOLVED] - El Forum - 08-10-2008

[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.


Could not delete a single image from a model!![SOLVED] - El Forum - 08-10-2008

[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


Could not delete a single image from a model!![SOLVED] - El Forum - 08-10-2008

[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;


Could not delete a single image from a model!![SOLVED] - El Forum - 08-10-2008

[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;  
}



Could not delete a single image from a model!![SOLVED] - El Forum - 08-10-2008

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