Jump to content

[SOLVED] Unexpected T-String


sam06

Recommended Posts

Any ideas?

 

The problem is Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/sam06/public_html/insideknowledge/contents.php on line 52

 

Line 52 is the one that starts <p>

 

and my code is

<?php

$result = mysql_query("SELECT * FROM towns") 
or die(mysql_error());  




while($row = mysql_fetch_array( $result )) {
?>
<p><?php echo $row['Section'] ?> - <a href="view.php?town=<?php echo '.$row['id'].' ?>"><?php echo '.$row['Name'].' ?></a></p>
<?
} 


?>

 

Any ideas?

 

Cheers,

Sam

Link to comment
https://forums.phpfreaks.com/topic/117222-solved-unexpected-t-string/
Share on other sites

<?php echo '.$row['id'].' ?>

 

that's your problem. you are trying to echo:

 

.$row[

 

since the single quote in the index escapes the string. try:

 

<?php echo $row['id']; ?>

 

EDIT:  phpcodec took the time to give you far better syntax - use his instead.

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.