drunknbass Posted April 13, 2006 Share Posted April 13, 2006 ok i have a question that shoudl be easy. when i delete a product from the cart i want ti to also delete all the attribute entires related to that product out of thier tables. there is a table store_classes and store_class_optionsi can get it to delete all records out of classes when the product is deleted, but i think i need an array or something to get rid of all the options to those classes, it only deltes the entries in the table for the first class.examplecolor:Black WhiteSize:small Largeit will delete the classes for size and color, but it will only delte the class_options for color (black, white)the small and large stay in the tablemaybe i need a loop or something..heres my code.[code]$sql_class_class = "select * from ".$prefix."store_classes where productid = $product"; $result1 = mysql_query ($sql_class_class); $row1 = mysql_fetch_array($result1); $classid = $row1["classid"]; $sql_class_options = "select * from ".$prefix."store_class_options where classid = $classid"; $result1 = mysql_query ($sql_class_options); $row1 = mysql_fetch_array($result1); $classid = $row1["classid"]; $result = "delete FROM ".$prefix."store_inventory WHERE product='$product'"; $row = mysql_query($result); $result = "delete FROM ".$prefix."store_classes WHERE productid='$product'"; $row = mysql_query($result); $result = "delete FROM ".$prefix."store_class_options WHERE classid='$classid'"; $row = mysql_query($result);[/code]i know why it only deletes the first class options, because it doesnt array the classid for each class, it only returns the value for the first entry 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.