Jump to content

banner in array


Pauls74462
 Share

Recommended Posts

$banner_scr[0]="http://www.MyWebSite.com/image-3048586_94830485" alt="My Photo" border="0" height="125" width="125">;How do I get this array to work with this code:<img src=\"$banner_src[$which_banner]\" border=\"0\"></a></center>";
the error I'm getting is:Parse error: syntax error, unexpected T_STRING in /home/mywebsite/public_html/TestBanner/index.php on line 10That error is in the $banner_src[0] line
Link to comment
Share on other sites

second line of bit of mess, not sure what you want, so i came up with this NOTE image ref should have extension .jpg, .png, .gif<?php$banner_src[0]='<img src="http://www.MyWebSite.com/image-3048586_94830485" alt="My Photo" border="0" height="125" width="125">';?><?php echo '<center><a href="#">'.$banner_scr[0].'</a></center>'; ?>

Edited by dsonesuk
Link to comment
Share on other sites

the error I'm getting is:Parse error: syntax error, unexpected T_STRING in /home/mywebsite/public_html/TestBanner/index.php on line 10That error is in the $banner_src[0] line
The reason you get that error is because you haven't escaped your quotes. You could do it like dsonesuk has it with single quotes or escape your double quotes:dsonesuk's way:$banner_src[0]='<img src="http://www.MyWebSite.com/image-3048586_94830485" alt="My Photo" border="0" height="125" width="125">';or escape double quotes:$banner_src[0]="<img src=\"http://www.MyWebSite.com/image-3048586_94830485\" alt=\"My Photo\" border=\"0\" height=\"125\" width=\"125\">";Actually you could also use single quotes inside your doubles:$banner_src[0]="<img src='http://www.MyWebSite.com/image-3048586_94830485' alt='My Photo' border='0' height='125' width='125'>";
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...