Date: 08/15/00
- Next message: David Robley: "Re: [PHP] Need assistance or clarification"
- Previous message: David Robley: "Re: [PHP] MySQL - field names"
- In reply to: callen: "Re: [PHP] odd addition error<>?"
- Next in thread: Sam Masiello: "RE: [PHP] odd addition error<>?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 15 Aug, callen wrote:
> 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 <email protected>
> Cell : 1.715.821.4006
> Home Phone: 1.715.426.6661
>
Somebody already mentioned, or hinted, that everything returned from
your database is treated as a string by PHP, so you may have to cast
some variables to integer or real.
Also you might try checking the type of the offending variables at
selected spots to see if that is indeed part of the problem.
And, as a last resort, is it possible that there is white space in any
of the variables?
Cheers
-- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: David Robley: "Re: [PHP] Need assistance or clarification"
- Previous message: David Robley: "Re: [PHP] MySQL - field names"
- In reply to: callen: "Re: [PHP] odd addition error<>?"
- Next in thread: Sam Masiello: "RE: [PHP] odd addition error<>?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

