bbram Posted January 10, 2011 Share Posted January 10, 2011 I am getting the following error: Why a Parse error: syntax error, unexpected T_STRING on line 16. Line 16 is my sql statement and I don't know why it is has an unexpected T_string. Can you possibly help and let me know what I did wrong? <?PHP $link = mysql_connect('localhost', 'root', ''); if (!$link) { //if no connection then display error die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db('movedb', $link); if (!$db_selected) { die ('Can\'t use movedb : ' . mysql_error()); } $sql= ("SELECT * FROM faq_table ORDER BY faq_subject_rank, faq_priority") or (die mysql_error()); ?> <html> <head> <title>FAQ page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="/atn.css" type="text/css"> </head> <body bgcolor="#FFFFFF" text="#000000"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?PHP while($rows=mysql_fetch_array($sql)) { ?> <tr> <td width="15%" height="30" colspan="2"> </td> <td width="70%" height="30"> <div align="center"><font size="3" face="Arial, Helvetica, sans-serif"><strong><em><? echo .rows[faq_subject]. ?></em></strong></font></div></td> </tr> <?php } ?> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/223958-why-a-parse-error-syntax-error-unexpected-t_string/ Share on other sites More sharing options...
Pikachu2000 Posted January 10, 2011 Share Posted January 10, 2011 You're missing something on that line: mysql_query. You're also going to find a problem here: <? echo .rows[faq_subject]. ?> Quote Link to comment https://forums.phpfreaks.com/topic/223958-why-a-parse-error-syntax-error-unexpected-t_string/#findComment-1157380 Share on other sites More sharing options...
bbram Posted January 10, 2011 Author Share Posted January 10, 2011 I see that I am missing the mysql_query at the beginning of the $sql but you explain to tell me what is wrong with the <? echo .rows[faq_subject]. ?> Quote Link to comment https://forums.phpfreaks.com/topic/223958-why-a-parse-error-syntax-error-unexpected-t_string/#findComment-1157435 Share on other sites More sharing options...
jdavidbakr Posted January 10, 2011 Share Posted January 10, 2011 I see that I am missing the mysql_query at the beginning of the $sql but you explain to tell me what is wrong with the <? echo .rows[faq_subject]. ?> . = the concatenate function, it must be between two strings or it will not work. You also need to put the $ before 'rows' - so you're correct syntax should be <? echo $rows['faq_subject'] ?> Quote Link to comment https://forums.phpfreaks.com/topic/223958-why-a-parse-error-syntax-error-unexpected-t_string/#findComment-1157438 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.