Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
no action for same tow MySQL order
Old 11-02-2006, 03:46 AM no action for same tow MySQL order
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Dear PHP MySQL Programmers,

When I try to 'Delete' the old total then 'Add' new total in same table it take Only one of them...

PHP Code:
  $Old_Total $hotel_cost $eht_days_q $eht_room_q $eht_room_p;
 
$New_Total $hotel_cost +  $s_days_q  *  $s_room_q  *  $s_room_p;
 
   
$update_cost1 mysql_query("UPDATE `offer` SET hotel_cost='".$Old_Total."' WHERE id='".$Offer_ID."'")or die(mysql_error());
   
$update_cost2 mysql_query("UPDATE `offer` SET hotel_cost='".$New_Total."' WHERE id='".$Offer_ID."'")or die(mysql_error()); 
when i delete one of $update_costX it work fine .. but both is not work only one of them...

What Kind of change should I dO ?!

Many Thanks.
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
 
Register now for full access!
Old 11-02-2006, 10:10 AM Re: no action for same tow MySQL order
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Up...
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Old 11-02-2006, 02:41 PM Re: no action for same tow MySQL order
kreoton's Avatar
Extreme Talker

Posts: 194
Trades: 0
then you run this script query $update_cost1 updates (lets say) yours record with id = 5, query $update_cost2 updates olso record with id = 5, so it is logical that you see only last query results
__________________

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
kreoton is offline
Reply With Quote
View Public Profile Visit kreoton's homepage!
 
Old 11-03-2006, 03:20 AM Re: no action for same tow MySQL order
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Hi kreoton,

What Happen is..

For Example:
if: hotel_cost='20' And: $Old_Total='10' And: $New_Total='4'


The new DB result should be = 14 ($update_cost1 to cut the 10) AND ($update_cost2 to add the 4).


here in my code it comes = 24, So the 10 still not go.. thats mean $update_cost1 not worked.. to cut that old result.

you can try the code in simple page ...

Last edited by ISSC; 11-03-2006 at 03:25 AM..
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Old 11-03-2006, 04:15 AM Re: no action for same tow MySQL order
ISSC's Avatar
Skilled Talker

Posts: 65
Name: A. Mansouri
Location: Jeddah, K.S.A
Trades: 0
Thanks All,

I got the Soloution By My Self

it was like:
PHP Code:
    $Sub_Total   $Old_Total $New_Total;
   
$update_cost mysql_query("UPDATE `offer` SET hotel_cost='".$Sub_Total."' WHERE id='".$Offer_ID."'")or die(mysql_error()); 
ISSC is offline
Reply With Quote
View Public Profile Visit ISSC's homepage!
 
Reply     « Reply to no action for same tow MySQL order
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15528 seconds with 12 queries