Jump to content

Archived

This topic is now archived and is closed to further replies.

spyke01

bad problems with mysql

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 working

ive 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

Share this post


Link to post
Share on other sites
Define "doesn't work" -- gives an error, doesn't produce the expected output?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.