Jump to content

Unlink function


emediastudios

Recommended Posts

Hey guys,

I have this code below, which works fine.

 

What i need to do is unlink the images from 2 tables, they are all in  table rows called "file"

 

unlink [file] from usedboats where id = id and,

unlink [file] from usedboatimages where cat = id

 

All the files are in a directory back one, ../uploaded the file name in the table is similar to uploaded/45638.jpg

so there is no need to add ../uploaded in the script, just ../

 

  if($secret == "3"){
   if($id != ""){
    if($q2 = mysql_query("DELETE FROM `usedboats` WHERE id = '$id'") && $q3 = mysql_query("DELETE FROM `usedboatimages` WHERE cat = '$id'"))

echo "Used Boat Deleted<br><br>";
   }
   $q = mysql_query("SELECT * FROM usedboats");
   echo "<div class='PageTitle'><b>Warning!!!</b> This will delete the used boat and all related images<br><br></div><table>";

   while($a = mysql_fetch_array($q)){
   echo "<tr><td><a href='admin.php?p=deleteusedboat&id=".$a[id]."'>".$a[title]."</a></td></tr>";
   }
   echo "</table>";
  }
  else include("../../../admin/admin/err.php");

Link to comment
https://forums.phpfreaks.com/topic/196576-unlink-function/
Share on other sites

I tried many times, but cant seem to get it right.

I am tired of adding test used boats and images as i keep deleting them and the file unlink has errors

The delete record function works finer, i just cant seem to work out the unlink file code.

Link to comment
https://forums.phpfreaks.com/topic/196576-unlink-function/#findComment-1032125
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.