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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.