Forum Moderators: coopster

Message Too Old, No Replies

unexpected character

problem with some code

         

WhosAWhata

4:55 am on Feb 23, 2004 (gmt 0)

10+ Year Member



I am recieving the following error on one of my scripts...
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/penguinp/www/www/aphistory/admin/addbooster.php on line 16

Parse error: parse error in /home/penguinp/www/www/aphistory/admin/addbooster.php on line 16

here are lines 15-17...

for ($i = 1; $i <= $noq; $i++) {
fputs($pob,"<? \$q$i = \"" . ${"q".$i} . "\";?>");
}

i can't seem to figure out what's wrong...help please

henry0

12:48 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is that supposed to be that way

<<<
fputs($pob,"<? \$q$i = \"" . ${"q".$i} . "\";?>");
>>>

here I cannot figure why you are escaping two quotes
<<<
$q$i = \""
>>>
I might be in need of coffee!
but will that be the cause:
$q$i = \"

Timotheos

5:00 pm on Feb 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think he wants the output to look like
$q1 = "foo"
so that's why the escape before the double quote.

I can't see anything wrong with the above. Are you sure your parse error is not happening before the loop? You could comment it out and see if you still get the error.