deleting from a path

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
corillo181
Forum Commoner
Posts: 76
Joined: Wed Apr 26, 2006 3:02 pm

deleting from a path

Post by corillo181 »

i'm trying to delete a fiel from database and from the dir.. i already can delete it from the database but how i do for the file path..

i have this much going..

Code: Select all

<?php
include'../includes/db.php';
$dir='/userpic/';
$pic=$_GET['delpic'];
$delpath=$dir.$pic;
unlink($delpath);
$co="DELETE FROM userpic WHERE name='$pic'";
$cod=mysql_query($co);
$ed=mysql_fetch_array($cod);
header('Location: index.php');
?>
when i click delete it deletes from the database but can't make it delete from path..
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

check out unlink()
corillo181
Forum Commoner
Posts: 76
Joined: Wed Apr 26, 2006 3:02 pm

Post by corillo181 »

:) it was my fault it was working just that i just a few file with almose the same name.. :oops:
Post Reply