Hi I''ve this problem
There is this form from where a user can delete his ads from the db. Now the the records get deleted but Im unable to unlink (delete) those images associated with the records. How do i chk whether the image from the array is associated with the record.
Below is the code dat is the input of the form
<input type=\"checkbox\" name=\"list[]\" value=\"<? echo $row[''fldbkid''] ?>\">
<input type=\"hidden\" name=\"img[]\" value=\"<? echo $row[\"fldbkimage\"] ?>\">
if ($page==\"delete\")
{
for ($j=0; $j < count($list); $j++)
{
unlink( $img[$j] );
$dquery = \"delete from items where id=$list[$j]\";
$dresult = mysql_query($dquery) or die(\"Query failed 1\");
}
header(\"Location: delete.php\");
}
Plz Help!
THanz
Unlinking Image Problem
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Not sure whether it was you or if something went a bit screwy but all those quotes shouldn't be escaped:
Have you read the user comments on the man page for unlink() it seems like people using Windows (you don't say which OS you're using so this may not apply to you) have had mixed success in getting it to work.
Mac
Code: Select all
<input type="checkbox" name="listї]" value="<?php echo $rowї'fldbkid'] ?>">
<input type="hidden" name="imgї]" value="<?php echo $rowї"fldbkimage"] ?>">
<?php
if ($page == "delete") {
for ($j=0; $j < count($list); $j++) {
unlink( $imgї$j] );
$dquery = "delete from items where id=$listї$j]";
$dresult = mysql_query($dquery) or die("Query failed 1");
}
header("Location: delete.php");
}
?>Mac
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK