Jump to content

bad problems with mysql


spyke01

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?
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.