Jump to content

Why a Parse error: syntax error, unexpected T_STRING


bbram

Recommended Posts

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>

 

Link to comment
Share on other sites

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'] ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.