Gruzin Posted July 19, 2006 Share Posted July 19, 2006 Here is my echo, but think I don't write it right. hope u can help, thanks.<?php echo '<img alt="" src="'.$imageArr[$imageShow].'">'."".'<a href='".$imageLink[$imageShow]."'>'; ?>P.S output:[color=red]Parse error: parse error, unexpected '\"', expecting ',' or ';' in /users/3d_cn/html/banner.php on line 44[/color] Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/ Share on other sites More sharing options...
Ninjakreborn Posted July 19, 2006 Share Posted July 19, 2006 [code]echo "<img alt=\"\" src=\"{$imageArr[$imageshow]}\"> <a href=\"{$imagelink[$imageshow]}\">";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60518 Share on other sites More sharing options...
Gruzin Posted July 19, 2006 Author Share Posted July 19, 2006 thanks, I'll try :) Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60522 Share on other sites More sharing options...
SammyP Posted July 19, 2006 Share Posted July 19, 2006 Did that solution work? I can see why yours didn't work in the first place but it is hard to find because of the way you use your quotes.After your href you drop out of your php string before the double quote goes in. And something similar later on too.Most importantly, you don't need to drop out of strings to include variables which is what businessman was showing.His code looks even simpler if you combine your quoting methods so you don't have to escape them:[code]echo '<img alt="" src="{$imageArr[$imageshow]}"> <a href="{$imagelink[$imageshow]}">';[/code]or [code]echo "<img alt='' src='{$imageArr[$imageshow]}'> <a href='{$imagelink[$imageshow]}'>";[/code]I'm not even certain you need the curly braces either. They are for more complicated structures, so possibly. But if the array index isn't a variable then you don't, so possibly not. Can't check right now for you. Try it:[code]echo "<img alt='' src='$imageArr[$imageshow]'> <a href='$imagelink[$imageshow]'>";[/code]Sam. Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60529 Share on other sites More sharing options...
Gruzin Posted July 20, 2006 Author Share Posted July 20, 2006 well I've tryed that but it doesn't work....It displays the picture with red cross and an underscore with link:{$imagelink[$imageshow]} (I see it on the status bar) Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60880 Share on other sites More sharing options...
Gruzin Posted July 20, 2006 Author Share Posted July 20, 2006 where are u guys, please help:( Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60914 Share on other sites More sharing options...
GingerRobot Posted July 20, 2006 Share Posted July 20, 2006 Try using the last posted by Sam:[code]<?phpecho "<img alt='' src='$imageArr[$imageshow]'> <a href='$imagelink[$imageshow]'>";?>[/code]because that should work. Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60916 Share on other sites More sharing options...
Gruzin Posted July 20, 2006 Author Share Posted July 20, 2006 I tryed but it doesn't work, what's my mistake:(here is the code:<?php $imageArr = array(); $imageArr[1] = "http://www.3d.caucasus.net/apartments/banners/banner1.jpg"; $imageArr[2] = "http://www.3d.caucasus.net/apartments/banners/banner2.jpg"; $imageArr[3] = "http://www.3d.caucasus.net/apartments/banners/banner3.jpg"; $imageLink[1] = "http://www.one.com"; $imageLink[2] = "http://www.two.com"; $imageLink[3] = "http://www.three.com"; $imageShow = array_rand($imageArr);?><?php echo "<img alt='' src='$imageArr[$imageshow]'> <a href='$imagelink[$imageshow]'>"; ?>P.S Here you can see the site, with that error:http://www.3d.caucasus.net Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60924 Share on other sites More sharing options...
GingerRobot Posted July 20, 2006 Share Posted July 20, 2006 The problem is to do with capitalisation. $imageshow is not the same as $imageShow.change the line to:<?php echo "<img alt='' src='$imageArr[$imageShow]'> <a href='$imageLink[$imageShow]'>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60928 Share on other sites More sharing options...
Gruzin Posted July 20, 2006 Author Share Posted July 20, 2006 I've done it but the picture is not linked........ Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60929 Share on other sites More sharing options...
GingerRobot Posted July 20, 2006 Share Posted July 20, 2006 New topic because?This is your html. You need to nest the image inside of the link tags:<?php echo "<a href='$imageLink[$imageShow]'><img alt='' src='$imageArr[$imageShow]'></a>"; Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60930 Share on other sites More sharing options...
Gruzin Posted July 20, 2006 Author Share Posted July 20, 2006 sorry for the new topic, it's not my fault, I was trying to post and there was an error (I"ll remove this topic)Here u can see the result, think it's not working correctly, thanks anywayhttp://www.3d.caucasus.net Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60931 Share on other sites More sharing options...
wildteen88 Posted July 20, 2006 Share Posted July 20, 2006 Topic has been merged. Please do not post now topics for no reason. Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60934 Share on other sites More sharing options...
GingerRobot Posted July 20, 2006 Share Posted July 20, 2006 Just remove the [/url] part. This forum puts it on after you have a url for some reason. Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60935 Share on other sites More sharing options...
Gruzin Posted July 20, 2006 Author Share Posted July 20, 2006 ok thanks guys, Think I have to work on myself Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-60936 Share on other sites More sharing options...
SammyP Posted July 21, 2006 Share Posted July 21, 2006 I assumed you had a </a> somewhere later. Do you? Quote Link to comment https://forums.phpfreaks.com/topic/15048-need-help-with-parse-error/#findComment-61675 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.