DBookatay Posted February 24, 2008 Share Posted February 24, 2008 I have a query (if a vehicle in inventory gets sold) the when it runs it takes a few items from one table ("Inventory") and moves them to a different table ("Sold") and then deletes the row in "Inventory". In my "Inventory" table there are 10 fields: "pic1" - "pic10" which none are required, but more so than not are all usually used, meaning there are 10 pictures of the vehicle. I use an image upload script that uploads the images, places them in a folder, creates a thumbnail in a seperate thumbnail folder, and adds the name of the image to the proper field. Is there a way to now reverse the process? Meaning that if I run my query (code below) and mark the vehicle sold, if any of the 10 fileds has a listing in it, it will delete the actual image from the folder? Can this easily be done? Here is the 2 queries to mark a vehicle sold: if (isset($_POST['sold'])) { $insertQuery = mysql_query("INSERT INTO Sold (stock, vin, year, make, model, trim, body, color, mileage) VALUES ('$stock', '$veh_VIN', '$veh_Year', '$veh_Mke', '$veh_Mdl', '$veh_Trm', '$veh_Bdy', '$veh_color', '$veh_Mls')") or die(mysql_error()); echo "<meta http-equiv=\"Refresh\" content=\"0; url=list.php?category=001\">";} // Delete Vehicle (When Marked Sold) if ($insertQuery) {$query = "DELETE FROM Inventory where stock = '{$_POST['stock']}'"; $result = mysql_query($query);} Quote Link to comment Share on other sites More sharing options...
themistral Posted February 24, 2008 Share Posted February 24, 2008 Have a look at the unlink function. http://uk.php.net/unlink 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.