Jump to content


unlink error

  • Please log in to reply
1 reply to this topic

#1 gabrielkolbe

  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 26 October 2006 - 07:11 PM

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

Warning: unlink(../logos/): Is a directory in /home/gabriel/public_html/include_cs/functions.php on line 1710

Here is the script..

$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?

The Devil never lies..he just almost tell the truth

#2 kenrbnsn

  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 26 October 2006 - 07:23 PM

What it looks like is that somehow "$row->photo1" is blank. I would put the unlink into an "if" statement:
	$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>';
I'm assuming you have a field called "id" in the table, so you can go look at the record afterwards.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users