spyke01 Posted January 20, 2006 Share Posted January 20, 2006 ok ive got this following bit of code:[code]$sql = "DELETE FROM `carts` WHERE (carts_order_id='$ORDERID' AND carts_item_id='$todelete' AND carts_item_type='SYSTEM') LIMIT 1"; $result = mysql_query($sql);echo $sql;$sql = "DELETE FROM `orders` WHERE orders_order_id='$ORDERID'"; $result = mysql_query($sql);echo $sql;$sql = "SELECT * FROM `systems` WHERE systems_order_id='$ORDERID'";$result = mysql_query($sql);if($row = mysql_fetch_array($result)) $SYSTEMID = $row['systems_system_id']; mysql_free_result($result);$sql = "DELETE FROM `systems` WHERE systems_order_id='$ORDERID' LIMIT 1";$result = mysql_query($sql); $sql = " DELETE FROM `systemparts` WHERE systemparts_system_id='$SYSTEMID'"; $result = mysql_query($sql);[/code]ok the problematic query is this:[code]$sql = "DELETE FROM `orders` WHERE orders_order_id='$ORDERID'"; [/code]heres the export of the table:[code]CREATE TABLE `orders` ( `orders_order_id` mediumint(8) NOT NULL auto_increment, `orders_user_id` mediumint(8) NOT NULL default '0', `orders_order_datetime` datetime NOT NULL default '0000-00-00 00:00:00', `orders_shipping` varchar(50) NOT NULL default '', `orders_shipping_price` decimal(12,2) NOT NULL default '0.00', `orders_tax` decimal(12,2) NOT NULL default '0.00', `orders_rush_fee` decimal(12,2) NOT NULL default '0.00', `orders_items_total` decimal(12,2) NOT NULL default '0.00', `orders_ship1` decimal(12,2) NOT NULL default '0.00', `orders_ship2` decimal(12,2) NOT NULL default '0.00', `orders_ship3` decimal(12,2) NOT NULL default '0.00', `orders_price` decimal(12,2) NOT NULL default '0.00', `orders_status` varchar(100) NOT NULL default '', `orders_tracking` varchar(100) NOT NULL default '', `orders_comments` varchar(250) NOT NULL default '', PRIMARY KEY (`orders_order_id`)) TYPE=MyISAM AUTO_INCREMENT=2233;-- -- Dumping data for table `orders`-- INSERT INTO `orders` VALUES (2232, 0, '0000-00-00 00:00:00', 'UPS Ground', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, '', '', '');[/code]now the thing is it looks like its perfect in everyway, but it doesnt do its job of deleting the order. But heres the kicker, [u]if you put it into phpmyadmin it works!![/u]its the same query but it doesnt work outside of phpmyadmin, ive tried adding sql statements together(ie the top 2 together, and the bottom 2 together) but it doesnt work like that either, but once again, [u]if you put it into phpmyadmin it works!![/u]anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
fenway Posted January 21, 2006 Share Posted January 21, 2006 I have no idea what you mean by "it doesn't work outside phpmyadmin". You'll have to make the substitutions somewhere. There's something else wrong. Quote Link to comment Share on other sites More sharing options...
spyke01 Posted January 21, 2006 Author Share Posted January 21, 2006 basicly, when i run mysql_query($sql) on the stement it doesnt actually work. ie it appears to go through, but when you check the database, its not workingive tried several things including using parentheses but no go, and i really need this statement to work, i may add another field to try and get it going, but im not sure Quote Link to comment Share on other sites More sharing options...
fenway Posted January 24, 2006 Share Posted January 24, 2006 Define "doesn't work" -- gives an error, doesn't produce the expected output? 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.