Jump to content


Photo

bad problems with mysql


  • Please log in to reply
3 replies to this topic

#1 spyke01

spyke01
  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 20 January 2006 - 10:34 PM

ok ive got this following bit of 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);

ok the problematic query is this:
$sql = "DELETE FROM `orders` WHERE orders_order_id='$ORDERID'";    

heres the export of the table:
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, '', '', '');

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, if you put it into phpmyadmin it works!!

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, if you put it into phpmyadmin it works!!

anyone have any ideas?

[a href="http://www.fasttracksites.com" target="_blank"]Cheap PHP Hosting[/a]

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 21 January 2006 - 12:37 AM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 spyke01

spyke01
  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 21 January 2006 - 01:23 AM

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

[a href="http://www.fasttracksites.com" target="_blank"]Cheap PHP Hosting[/a]

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 24 January 2006 - 07:09 PM

Define "doesn't work" -- gives an error, doesn't produce the expected output?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users