jrodd32 Posted September 13, 2006 Share Posted September 13, 2006 line 16:print"<td width="30%" valign="top" align="left" style="padding-left:2" height="32">";I don't understand why I getting this message Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/ Share on other sites More sharing options...
wildteen88 Posted September 13, 2006 Share Posted September 13, 2006 You need to escape your quotes within the print statement or use single quotes for the print statement[b]Escaped quotes[/b][code=php:0]print "<td width=\"30%\" valign=\"top\" align=\"left\" style=\"padding-left:2\" height=\"32\">";[/code][b]Single Quotes[/b][code=php:0]print '<td width="30%" valign="top" align="left" style="padding-left:2" height="32">';[/code]You cannot use double quotes within double quotes. You will need to escape the double quotes otherwise PHP will think you have ended the string which you havn't. Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91124 Share on other sites More sharing options...
obsidian Posted September 13, 2006 Share Posted September 13, 2006 you're not escaping your quotes, so the parser is ending your print statement early. you need to escape the double quotes or use singles instead:[code]<?php// do this:print "<td width=\"30%\" valign=\"top\" align=\"left\" style=\"padding-left:2\" height=\"32\">";// or this:print '<td width="30%" valign="top" align="left" style="padding-left:2" height="32">';?>[/code][b]**EDIT**[/b]wow... beat to the punch again ;) ... great answer, though, right? lol Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91126 Share on other sites More sharing options...
jrodd32 Posted September 13, 2006 Author Share Posted September 13, 2006 that didn't work, I still got the same error Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91129 Share on other sites More sharing options...
wildteen88 Posted September 13, 2006 Share Posted September 13, 2006 Post your actuall code here. Not just line 16.Also which example did you use? Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91188 Share on other sites More sharing options...
jrodd32 Posted September 13, 2006 Author Share Posted September 13, 2006 [code]<?phpfunction printpage($type,$email,$coach,$coachtype);{ print'<HTML>'; print'<HEAD>'; print'<FONT FACE='Arial'>'; print'<Basefont size=2>'; print'<META NAME='Kentucky High School Athletic Association (KHSAA)'CONTENT='Sports High School KHSAA Kentucky High School Athletic Association'>'; echo"<TITLE>KHSAA Current List of $coachtype Coaches</TITLE>'; print'</HEAD>'; print'<BODY>'; print'<Body Background=' ' BGColor=#FFFFFF Text=#000000 Link=#0000FF VLink=#800080 ALink=#FF0000>'; print'<p><br>'; print'</p><table border='0' cellpadding='0' cellspacing='0' width='60%' bgcolor='#FFFFFF'>'; print'<tr>'; print'<td width='50%' align='center'>'; print'<p align='center'>'; print'<a href='http://www.khsaa.org/'>'; print'<img src='http://www.khsaa.org/images/khslogo2.gif' border='0'></a></td>'; print'<td width='50%' align='center'>'; print'<p align='center'>'; print'<a href='http://www.khsaa.org/FTR/banners/clickthru_img.php3'>'; print'<img src='http://www.khsaa.org//FTR/banners/banner_img.php3' border='0'></a></td>'; print'</tr>'; print'</table>'; print'<outpad,'<br>'; echo"<br><b>KHSAA Current Master List of $coachtype as of '; print date('l F jS Y h:i A'); print'</b>'; print'<BR>'; print'<FONT FACE='Courier'>'; print'<Basefont size=2></p>'; print'<PRE>'; printf("%-25s ","Head Coach"); printf("%-30s ","School"); printf("%-20s ","City"); printf("%-20s ","Phone Number"); printf("%-20s ","Fax Number"); printf("%-50s <br><hr>","Coach E-mail"); while($coaches=mysql_fetch_array($coachlist)) { printf("%-25s ",$coaches[$coach]); printf("%-30s ",$coaches[school]); printf("%-20s ",$coaches[city]); printf("%-20s ",$coaches[phone]); printf("%-20s ",$coaches[faxphone]); printf("%-50s ",$coaches[$email]); print("<br>"); } print("<hr>"); echo 'Copyright © 2001-2006 Kentucky High School Athletic Association (KHSAA), all rights reservered<br> This page is for the exclusive use of the KHSAA. Other use is strictly prohibited. Usage is monitored</font>'; print'</PRE>'; print'</html>';}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91225 Share on other sites More sharing options...
obsidian Posted September 13, 2006 Share Posted September 13, 2006 notice on your bolded line that you start the echo statement with double quotes, but you end it with single quotes. you've got to stay consistant when you open and close strings. Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91231 Share on other sites More sharing options...
Hepp Posted September 13, 2006 Share Posted September 13, 2006 You have all single quotes. Once you use the print or echo function in PHP, you need to use quotes. Like this:[color=green]echo("<font face=\"Verdana\">OMG THIS IS SO COOL!</font>");[/color]You have:[color=red]echo('<font face='Verdana'>OMG THIS IS SO COOL!</font>');[/color]You can't do that. That's why you're getting that error. Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91233 Share on other sites More sharing options...
steelmanronald06 Posted September 13, 2006 Share Posted September 13, 2006 [quote author=Hepp link=topic=107918.msg433635#msg433635 date=1158170470]You have all single quotes. Once you use the print or echo function in PHP, you need to use quotes. Like this:[color=green]echo("<font face=\"Verdana\">OMG THIS IS SO COOL!</font>");[/color]You have:[color=red]echo('<font face='Verdana'>OMG THIS IS SO COOL!</font>');[/color]You can't do that. That's why you're getting that error.[/quote]Or if you don't want to escape strings this will work as well:[color=green]echo("<font face='Verdana'>OMG THIS IS SO COOL!</font>");[/color]Notice how I used single quotes around the face attribute. Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91244 Share on other sites More sharing options...
redarrow Posted September 13, 2006 Share Posted September 13, 2006 Can you put your post in code /code please Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91249 Share on other sites More sharing options...
steelmanronald06 Posted September 13, 2006 Share Posted September 13, 2006 Don't know why it matters, but I will edit it for him. Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91252 Share on other sites More sharing options...
obsidian Posted September 13, 2006 Share Posted September 13, 2006 [quote author=steelmanronald06 link=topic=107918.msg433657#msg433657 date=1158171623]Don't know why it matters, but I will edit it for him. [/quote]only advantage i can think of is that he may be able to see his own mistakes with the color-coding ;) Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91256 Share on other sites More sharing options...
redarrow Posted September 13, 2006 Share Posted September 13, 2006 tell me how this comes out please cheers.might ask your self why did redarrow use html and then use php and php in html well the truth is that when you get your site submitted to search engines your have more chance of a good ranking using html without the print statement.meny other users might argue that point but that why my websites and clients websites are on the first page of google msn and yahoo and stay there for time.good luck.[code]<?phpfunction printpage($type,$email,$coach,$coachtype){?> <HTML> <HEAD> <FONT FACE="Arial"> <Basefont size="2"> <META NAME="Kentucky High School Athletic Association (KHSAA)"CONTENT="Sports High School KHSAA Kentucky High School Athletic Association"> <TITLE>KHSAA Current List of <?php echo $coachtype; ?> Coaches</TITLE> </HEAD> <BODY> <Body Background=" " BGColor=#FFFFFF Text=#000000 Link=#0000FF VLink=#800080 ALink=#FF0000> <p><br> </p><table border="0" cellpadding="0" cellspacing="0" width="60%" bgcolor="#FFFFFF"> <tr> <td width="50%" align="center"> <p align="center"> <a href="http://www.khsaa.org/"> <img src="http://www.khsaa.org/images/khslogo2.gif" border="0"></a></td> <td width="50%" align="center">'; <p align="center"> <a href="http://www.khsaa.org/FTR/banners/clickthru_img.php3"> <img src="http://www.khsaa.org//FTR/banners/banner_img.php3" border="0"></a></td> </tr> </table> outpad,<br> <br><b>KHSAA Current Master List of <?php echo $coachtype; ?> as of <?php echo date('l F jS Y h:i A'); ?> </b> <BR> <FONT FACE="Courier"> <Basefont size=2></p><?phpprint"<PRE>"; printf("%-25s ","Head Coach"); printf("%-30s ","School"); printf("%-20s ","City"); printf("%-20s ","Phone Number"); printf("%-20s ","Fax Number"); printf("%-50s <br><hr>","Coach E-mail"); while($coaches=mysql_fetch_array($coachlist)) { printf("%-25s ",$coaches[$coach]); printf("%-30s ",$coaches[school]); printf("%-20s ",$coaches[city]); printf("%-20s ",$coaches[phone]); printf("%-20s ",$coaches[faxphone]); printf("%-50s ",$coaches[$email]); print("<br>"); }?><div align="center"><hr> Copyright © 2001-2006 Kentucky High School Athletic Association (KHSAA), all rights reservered<br> This page is for the exclusive use of the KHSAA. Other use is strictly prohibited. Usage is monitored</font></div> </PRE> </html><?php}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91260 Share on other sites More sharing options...
jrodd32 Posted September 13, 2006 Author Share Posted September 13, 2006 It will display the list now but this error:Parse error: parse error, unexpected $ in /home/httpd/vhosts/khsaa.org/subdomains/admin/httpdocs/jerrod/tool_kit.inc on line 170now shows. I have checked my brackets and <php ?> tags and unless I missed something they line up.The error is weird because it is the last line in my file and the only code on it is:?> Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91280 Share on other sites More sharing options...
redarrow Posted September 13, 2006 Share Posted September 13, 2006 your missing a } bracket trust me i ment a brace lol lol.did my way work i got it to work here?i am still in stiches lol about the bracket. Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91284 Share on other sites More sharing options...
jrodd32 Posted September 13, 2006 Author Share Posted September 13, 2006 I think i used your way to make it work. I fixed the other problem. Thanks for the help, you and everyone else Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91290 Share on other sites More sharing options...
redarrow Posted September 13, 2006 Share Posted September 13, 2006 no problam well done mate, please goto your first post and press modify and alter the topic add [solved]good luck. Quote Link to comment https://forums.phpfreaks.com/topic/20629-parse-error-parse-error-unexpected-t_string-in-line-16-solved/#findComment-91293 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.