[thelist] PHP deleting a file

Jeremy Weiss jweiss at cox-internet.com
Wed Oct 12 05:48:36 CDT 2005


I'm needing some help with the following PHP script. I'm trying to check and
see if $oldphoto is equal to nophoto.gif. It if is equal I want it to do
nothing. Otherwise I want it to delete $oldphoto. The problem is, it deletes
$oldphoto either way.

  if ($oldphoto != "nophoto.gif") {
    // Delete the agents existing photo
    @unlink("$oldphoto");
  }


While playing with this I also tried writing it this way and it still
deleted the file no matter what.

  if ($oldphoto == "nophoto.gif") {
    // do nothing
  }else{
    // Delete the agents existing photo
    @unlink("$oldphoto");
  }

Can anyone point out my error here. I've run out of ideas.

TIA
-jeremy



More information about the thelist mailing list