Re: odd addition error<>?

From: Date: Tue, 15 Aug 2000 18:56:29 +0000
Subject: Re: odd addition error<>?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-11858@lists.php.net to get a copy of this message
Joao Prado Maia wrote: > I have no idea, please show us the complete code regarding these routines. relevant part of Block1 if ($carr ==1) { .... $query2 = "select $nzone from $table where ID='$w_total'"; $result2 = MYSQL_QUERY($query2); if ($arr = mysql_fetch_row($result2)) { $fee = $arr[0]; echo " The Shipping Fee is: $fee <br>" ; $carrier= "Speedee Delivery"; } ...( $fee is not changed any further in code) } relevant part of block2 if ($carr ==2) { .... $buffer=fgets($fp,100); if ( ereg ( "^(<\!TotalCharges>)([0-9]{1,4})(\.)([0-9]{1,})(<\!/TotalCharges>)", $buffer, $regs)) { $fee = $regs[0]; echo "The shipping fee is: $fee <br>"; //this prints out with correct value $carrier="Fed Ex Ground"; } } .... ($fee is not changed further in code) } Then after these two conditionals: $handling =2.00; echo "Fee again is $fee <br>"; $sh += $fee; echo "SH is: $sh <br>"; $sh += $handling; echo "Sh is $sh"; //which prints "2" when coming from block2 With Block 1 everything works, with Block 2 addition is wrong ( $sh += $$fee; ) echoes out 0. -- Christopher C.M. Allen http://design.driver8.org/ Email: callen@driver8.org Cell : 1.715.821.4006 Home Phone: 1.715.426.6661

« previous php.general (#11858) next »