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>

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.