Pauls74462 Posted June 9, 2010 Share Posted June 9, 2010 $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>"; Link to comment Share on other sites More sharing options...
dsonesuk Posted June 9, 2010 Share Posted June 9, 2010 $banner_scr[0]='<img src="http://www.MyWebSite.com/image-3048586_94830485" alt="My Photo" border="0" height="125" width="125">';<?php echo $banner_src[$which_banner];?></a></center>"; Link to comment Share on other sites More sharing options...
Pauls74462 Posted June 9, 2010 Author Share Posted June 9, 2010 $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 More sharing options...
dsonesuk Posted June 9, 2010 Share Posted June 9, 2010 sorry did not spot error in your code, ie array names dont match $banner_scr[0] cmpared to $banner_src[$which_banner];should be:$banner_src[0]='<img src="http://www.MyWebSite.com/image-3048586_94830485" alt="My Photo" border="0" height="125" width="125">';<?php echo $banner_src[$which_banner];?></a></center>"; Link to comment Share on other sites More sharing options...
dsonesuk Posted June 9, 2010 Share Posted June 9, 2010 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>'; ?> Link to comment Share on other sites More sharing options...
ShadowMage Posted June 10, 2010 Share Posted June 10, 2010 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] lineThe 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.