Forum Moderators: coopster

Message Too Old, No Replies

PHP syntax error - unexpected T_STRING

I am not able to fix this code

         

toamanz

5:24 pm on Mar 11, 2007 (gmt 0)

10+ Year Member



print("<td width = '20%' bgcolor='#ffffff' style='border-top: 0px solid #FFFFFF;'>
<script type='text/javascript'>
var sliderwidth='168px'var sliderheight='831px';var slidespeed='2';
slidebgcolor='#990000';var topslide=new Array();
var finalslide=' ';
topslide[0]=
'<a href="http://www.example.com/ads/index.php?action=show&id=12"><img src="./images/albums/rang.png" width = "100%" border = 0></a>'

</td>");

I have no idea how to fix this error on line 6 which starts with topslide[0] and the error is as follows

Parse error: syntax error, unexpected T_STRING in /home/baazaco/public_html/test/music/index.php on line 11

Any help will be really really appreciated.

[edited by: eelixduppy at 5:30 pm (utc) on Mar. 11, 2007]
[edit reason] exemplified domain name [/edit]

toamanz

5:26 pm on Mar 11, 2007 (gmt 0)

10+ Year Member



Just to let you know that the error comes on line 6 which start with topslide[] and not line 11..it was a submission mistake...

cmarshall

5:32 pm on Mar 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

Did you solve your problem, then?

eelixduppy

5:34 pm on Mar 11, 2007 (gmt 0)



Welcome to WebmasterWorld [webmasterworld.com], toamanz

You must escape the double quotes on that line:


'<a href=\"http://www.example.com/ads/index.php?action=show&id=12\"><img src=\"./images/albums/rang.png\" width = \"100%\" border = 0></a>'

Notice the use of the backslash (\) for escaping quotes. For more information, read the documentation for Strings [us3.php.net] at php.net.

Good luck! :)

toamanz

6:18 pm on Mar 11, 2007 (gmt 0)

10+ Year Member



Hi there,

Now my problem is that the solution you given me, I added to the entire script but at the end, it still gives me the error as

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
the line which it is indicating is the end of the script...which is

</td>");

print("<td ALIGN = 'center' width = '20%' bgcolor = '#990000'>

<script type=\"text/javascript\">
//Specify the slider's width (in pixels)
var sliderwidth=\"168px\"
//Specify the slider's height
var sliderheight=\"831px\"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=2
//configure background color:
slidebgcolor=\"#990000\"

topslide[0]='<a href=\"http://www.example.com/ads/index.php?action=album&id=535\"><img src=\"./images/albums/rang_de_basanti.png\" width = \"100%\" border = 0></a>'

----code
----code
----code

</td>");

The last one is ended the same as shown, stil its giving the issue..i dont want to cut and paste the code here but the code is as shown on the link above. I really really need to sort this out. Any help will be appreciated guys.

[edited by: eelixduppy at 6:24 pm (utc) on Mar. 11, 2007]
[edit reason] exemplified domain - TOS [webmasterworld.com] [/edit]

RonPK

6:43 pm on Mar 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you keep having problems with quoting and escaping text that only contains HTML and JavaScript, why not drop out of PHP? Or use heredoc syntax [nl2.php.net].