On 15 Sep 2003 23:56:02 -0700,
ho**********@yahoo.co.uk (Hong) wrote:
I am trying to create a switch but I do not know why I am geting an
error message, can someone tell me what is wrong,
Error Message;
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/home/natuk/public_html/php/order-server.php on line 2
Yet that character isn't in the code you posted.
Are you sure this is the same code? With the $server variable filled in, and
the other mistake further down corrected, this runs fine on my server.
What PHP version?
How are you running it?
Most hits from a Google search show similar messages appearing in some
circumstances when running an old version of PHP as CGI.
Parse error: parse error in
/home/natuk/public_html/php/order-server.php on line 2
my script is as follows;
<?php
switch ( $server )
Where is $server defined? Looks like you're relying on register_globals = on.
{
case "celeron_special_5":
case "celeron_special_6":
$monthly_price = 89.99 AND $setup =19.99 ;
Weird use of AND here.
$monthly_price = 89.99;
$setup = 19.99;
Also be very wary of using floating point numbers for money; due to the way
computers work, they are approximations, and will lose accuracy the more
calculations you do with them. Use integers multiplied up to the minor currency
unit (or fraction of, if relevant). e.g.
$monthly_price = 8999;
$setup = 1999;
And only divide back down (here by 100) when displaying.
break;
case "p4_special_1":
case "p4_special_2":
$monthly_price = 99.99 AND $setup = 19.99;
break;
}
$total = $server + $monthly;
Where is $monthly defined? Did you mean $monthly_price?
--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (
http://www.andyh.co.uk)
Space: disk usage analysis tool (
http://www.andyhsoftware.co.uk/space)