Hello, I'm pretty new to php, and I've decided to make a ad banner rotator for my practice site in class. This looks similar to other php rotator scripts, but I can't really see what's the error. All I receive is Parse error: syntax error, unexpected T_STRING on line 7 Any help for a newbie would be greatly appreciated =) <div class="headadvert_468x60"> <?php $bannerCounter = 2; $bannerCode[$bannerCounter] = ‘<a href="http://www.example.com/" target="5" onmouseover="window.status='http://www.example.com/';return true;" onmouseout="window.status=' ';return true;"> <img src="http://www.example.com/" width="468" height="60" alt="Random wording here" border="0"/></a>‘; $bannerCounter++; $bannerCode[$bannerCounter] = ‘<a href="http://www.example.com/" target="5" onmouseover="window.status='http://www.example.com/';return true;" onmouseout="window.status=' ';return true;"> <img src="http://www.example.com/" width="468" height="60" alt="Random Wording Here!" border="0"/></a>‘; $bannerCounter++; $bannerAdTotals = $bannerCounter – 1; if($bannerAdTotals>1) { mt_srand((double)microtime() * 1234567); $bannerPicked = mt_rand(1, $bannerAdTotals); } else { $bannerPicked = 1; } $bannerAd = $bannerCode[$bannerPicked]; echo $bannerAd; ?> </div> PHP:
<div class="headadvert_468x60"> <?php $bannerCounter = 2; $bannerCode[$bannerCounter] = '<a href="http://www.example.com/" target="5" onmouseover="window.status=\'http://www.example.com/\';return true;" onmouseout="window.status=\' \';return true;"> <img src="http://www.example.com/" width="468" height="60" alt="Random wording here" border="0"/></a>'; $bannerCounter++; $bannerCode[$bannerCounter] = '<a href="http://www.example.com/" target="5" onmouseover="window.status=\'http://www.example.com/\';return true;" onmouseout="window.status=\' \';return true;"> <img src="http://www.example.com/" width="468" height="60" alt="Random Wording Here!" border="0"/></a>'; $bannerCounter++; $bannerAdTotals = $bannerCounter – 1; if($bannerAdTotals>1) { mt_srand((double)microtime() * 1234567); $bannerPicked = mt_rand(1, $bannerAdTotals); } else { $bannerPicked = 1; } $bannerAd = $bannerCode[$bannerPicked]; echo $bannerAd; ?> </div> PHP: Escape your single quotes, with a backslash.
Tried it out, thanks =) Still needs a bit modification on my end but it fixed things here and there. Thanks +rep