Jump to content


Photo

why isn't this code workin


  • Please log in to reply
4 replies to this topic

#1 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 26 May 2006 - 05:47 PM

so yeah this used to work for me before it delete the name from the database and the folder..but now i tryed to use it with another code and is not work..

i changed it in the right places i made this code before and it works but i tried everythign i know and is not working.. can someone see something i'm not seen?

if(isset($_POST['Delete'])){
$dir="albums/";
$pic=$picturedes['fotoname'];
$dir='userpic/'.$pic;
unlink($dir);
$co="DELETE FROM tra_photo WHERE fotoname='$pic'";
$cod=mysql_query($co)or die(mysql_error());

if($co){
echo 'picture deleted!';
}else{
echo 'could not delete...';
}
}


#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 May 2006 - 05:50 PM

What isn't it doing that you're expecting it to do?
Legend has it that reading the manual never killed anyone.
My site

#3 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 26 May 2006 - 06:00 PM

[!--quoteo(post=377360:date=May 26 2006, 01:50 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 26 2006, 01:50 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
What isn't it doing that you're expecting it to do?
[/quote]


it has to delete the name from the database and delete the file with the same name from a directory..

#4 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 26 May 2006 - 09:52 PM

is the directory to the file "albums/userpic/.$pic;" or just 'userpic/'.$pic;

if it's the first, you need to change

$dir='userpic/'.$pic;
to
$dir.='userpic/'.$pic;

NoGray.com


#5 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 26 May 2006 - 10:15 PM

not really, it works the way i ha dit.. just had a linking problem..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users