Jump to content

[SOLVED] PHP Error


bravo14

Recommended Posts

Hi All

 

Using the code below I am getting an error of

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/fhlinux171/b/bravo14.co.uk/user/htdocs/gavster/headlines.php on line 41,

 

however I have copied a page that works and changed the relevant parts which will mean that line 41 is OK, I appreciate that the code could probably be slicker, however still learning php, can anyone spot any errors with the code that would get the error ?

 

<?php
$con = mysql_connect('ip', 'user', 'password', true);
if(!$con)
{
      die('Could not connect: ' . mysql_error());
}
mysql_select_db('gavstersays', $con);
$result = mysql_query('SELECT * FROM `posts`where `topic_id`=\'' . $_GET['topic_id'] . '\'' , $con) or die(mysql_error());
if(mysql_num_rows($result) < 1) 
{ 

   echo('<tr><td colspan="2">Sorry, no results were found.</td></tr>'); 
} 
else 
{ 
   while($row = mysql_fetch_array($result))
    {
echo('<tr><td>'.date("d-M-Y", strtotime($row[postdate])).'</td>');
echo('<td><a href="article.php?post_id='.$row[post_id].'">'.$row[title].'</a></td></tr>');
}
}
?>

Link to comment
Share on other sites

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.