sam06 Posted July 29, 2008 Share Posted July 29, 2008 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 More sharing options...
akitchin Posted July 29, 2008 Share Posted July 29, 2008 <?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. Link to comment https://forums.phpfreaks.com/topic/117222-solved-unexpected-t-string/#findComment-603015 Share on other sites More sharing options...
phpcodec Posted July 29, 2008 Share Posted July 29, 2008 try <?php $result = mysql_query("SELECT * FROM towns") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo '<p>'.$row['Section'] .' - <a href="view.php?town='.$row['id'].' ">'.$row['Name'].'</a></p>'; } ?> Link to comment https://forums.phpfreaks.com/topic/117222-solved-unexpected-t-string/#findComment-603016 Share on other sites More sharing options...
sam06 Posted July 29, 2008 Author Share Posted July 29, 2008 Thats working great, many thanks. Link to comment https://forums.phpfreaks.com/topic/117222-solved-unexpected-t-string/#findComment-603018 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.