$sql doesn't exist. $s returns boolean (success/failure). What is the point of line 9?
If all the images are in the same folder, you can dispense with the '$t' query.
Anyway, $t is just a resource - not a string (file location).
You need to call mysql_fetch_assoc() to get the path.
diafol
Keep Smiling
10,653 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,510
Skill Endorsements: 57
First this is wrong:
if ($sql = $s){
here you are assignin a value, not comparing, to compare use == or for boolean ===, so rewrite it to:
if ($sql == $s){
Second, I don't see $sql declared anywhere, you will get an error here.
Third, you have to extract the filename from the query:
if(mysql_num_rows($t) > 0)
{
# loop results
while($row = mysql_fetch_object($t))
{
unlink('/path/'.$row->filename); # and extension if this is saved a part
}
header('Location: lee_remove.php');
}
bye!
cereal
Veteran Poster
1,145 posts since Aug 2007
Reputation Points: 344
Solved Threads: 222
Skill Endorsements: 22
Echo what is stored in $image. I'm pretty confident it's an empty string or null, because you first delete the id's in $p and then try to select them.
pritaeas
Posting Prodigy
9,287 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,458
Skill Endorsements: 86
Question Answered as of 4 Months Ago by
arti18,
diafol,
cereal
and 1 other