emediastudios Posted March 26, 2010 Share Posted March 26, 2010 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"); Quote Link to comment Share on other sites More sharing options...
trq Posted March 26, 2010 Share Posted March 26, 2010 Do you have a question? Quote Link to comment Share on other sites More sharing options...
xcandiottix Posted March 26, 2010 Share Posted March 26, 2010 Do you have a question? heh heh heh You can't: mysql_query("UPDATE usedboats SET picturelocation = ' ' WHERE id = '$id'"); and ditto for the other one? Quote Link to comment Share on other sites More sharing options...
emediastudios Posted March 26, 2010 Author Share Posted March 26, 2010 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. Quote Link to comment Share on other sites More sharing options...
emediastudios Posted March 26, 2010 Author Share Posted March 26, 2010 Do you have a question? How do i unlink the files in the tables usedboats and usedboatimages? under row "file" in both, the images reside in a directory back one level ../ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.