DJTim666 Posted December 10, 2007 Share Posted December 10, 2007 I am trying to allow my users to type the amount of things they would like to remove from a gallery. So lets say they have 40 of the same thing in the gallery and they want to remove 23. {GALLERY ITEM} | {QUANTITY} | {AMOUNT TO REMOVE} I've tried several different things with all of them failing. Anyone have an idea? -- DJ Quote Link to comment Share on other sites More sharing options...
kratsg Posted December 10, 2007 Share Posted December 10, 2007 How are these items stored in the gallery? Is this a database with each item being a separate row? And is your question pertaining to coding the form, or coding the script to handle the form? Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted December 10, 2007 Author Share Posted December 10, 2007 Items are stored in a database and each item is a seperate row. They are stored by location. For galleries the location of the items is 9. And my question is how am I supposed to handle the form when submitted. Quote Link to comment Share on other sites More sharing options...
kratsg Posted December 10, 2007 Share Posted December 10, 2007 I believe the LIMIT will help you here $gallery_item = mysql_real_escape_string($_POST['item']); $amt_to_remove = mysql_real_escape_string($_POST['amount']); mysql_query("DELETE FROM `table` WHERE `some_item` = $gallery_item LIMIT $amt_to_remove") or die(mysql_error()); See if that works ;-) Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted December 10, 2007 Author Share Posted December 10, 2007 Won't work because I am updating locations not deleting items. Quote Link to comment Share on other sites More sharing options...
kratsg Posted December 10, 2007 Share Posted December 10, 2007 Then change from mysql delete, to mysql update mysql_query("UPDATE `table` SET `location` = '#' WHERE `some_item` = $gallery_item LIMIT $amt_to_remove") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted December 10, 2007 Author Share Posted December 10, 2007 That might work. Trying now. 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.