gabrielkolbe Posted October 26, 2006 Share Posted October 26, 2006 I have a website where people can add and delete pictures. All worked fine, untill recently..out of the blue. I get error messages when trying to delete a picture..[quote]Warning: unlink(../logos/): Is a directory in /home/gabriel/public_html/include_cs/functions.php on line 1710[/quote]Here is the script..[code] $query="SELECT * FROM business_site2 WHERE user_id = '".$_SESSION['user_id']."'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_object($result)) { unlink("../logos/".$row->photo1); }code]I checked the php manual but can not see where the problem lays..anyone any ideas?[/code] Link to comment https://forums.phpfreaks.com/topic/25227-unlink-error/ Share on other sites More sharing options...
kenrbnsn Posted October 26, 2006 Share Posted October 26, 2006 What it looks like is that somehow "$row->photo1" is blank. I would put the unlink into an "if" statement:[code]<?php $query="SELECT * FROM business_site2 WHERE user_id = '".$_SESSION['user_id']."'"; $result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error()); while ($row = mysql_fetch_object($result)) { if ($row->photo1 != '') unlink("../logos/".$row->photo1); else echo 'Error: there is something wrong, the name of the photo is all blank (' . $row->id . ')<br>'; }?>[/code]I'm assuming you have a field called "id" in the table, so you can go look at the record afterwards.Ken Link to comment https://forums.phpfreaks.com/topic/25227-unlink-error/#findComment-115021 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.