FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP - Error





DanielXP
i keep getting Parse error: syntax error, unexpected T_VARIABLE in plusnews/display.php on line 107

this is the code

Code:
<?php
include("config.php");
  switch($_GET['action']) {

default:   
$getnews = mysql_query("SELECT * from news order by id DESC");
while ($news = mysql_fetch_array($getnews))
{
//Comment ID
$nid = $news[id];
//News ID
$id = $news[id];
$nocomments = mysql_query("SELECT COUNT(1) FROM `comments` WHERE `nid` = '$nid'");
$nocomments = mysql_fetch_row($nocomments);
$nocomments = $nocomments[0];
echo "<table width='507' border='1'>
<tr>
    <td width='449' background='Images/bar.png'>$news[title] - Posted by $news[author] on $news[postdate]</td>
  </tr>
  <tr>
    <td>$news[content]</td>
  </tr>
  <tr>
    <td>($nocomments) <a href='display.php?action=viewnews&id=$id'><font color='#000000'>Comments</font></a></td>
  </tr>
  </table>";
  }
  break;

  case "viewnews":
 
$id = $_GET['id'];
$select = "select * from news where id=$id";
$select2 = "select * from comments where nid=$id ORDER BY id DESC";
 
  $getnews = mysql_query($select)
or die(mysql_error());


//if the article is not in the database
  if (mysql_num_rows($getnews) == "0") {

echo 'Article not found!';
exit();
}
 
 //gets the news from the database
 $news = mysql_fetch_array($getnews)
or die(mysql_error());

 
//view news at top
echo "<table width='507' border='1'>
<tr>
    <td width='449' background='Images/bar.png'>$news[title] - Posted by $news[author] on $news[postdate]</td>
  </tr>
  <tr>
    <td>$news[content]</td>
  </tr>
  </table>";
 
  $getcomments = mysql_query($select2);
  while ($comments = mysql_fetch_array($getcomments))
{
echo "<br><br>";
echo "<table width='300' border='1'>
<tr>
    <td width='449' background='Images/bar.png'>By $comments[author] on $comments[postdate]</td>
  </tr>
  <tr>
    <td>$comments[content]</td>
  </tr>
  </table>";
  }

//shows the form to add a comment
echo "<form method='POST' action='display.php?action=addcomment&id=$id'>";
echo "<table width='225' border='0'>
  <tr>
    <td width='65'>Name:</td>
    <td width='144'>
      <input type='text' name='name'>    </td>
  </tr>
  <tr>
    <td>Comment:</td>
    <td><textarea name='comments' cols='40' rows='10'></textarea></td>
  </tr>
</table>";
echo "<input type='submit' value='Add Comment' name='add'>";
echo "</form>";

//Checks how many comments there are
if (mysql_num_rows($getcomments) == "0") {
echo 'There are currently no comments';
}


  break;
 
case "addcomment":

//Gets all the info
$id = $_GET['id'];
$name = htmlspecialchars($_POST[name]);
$comment = htmlspecialchars($_POST[comment]);
$date = date(d,m,y)
$ip = $_SERVER['REMOTE_ADDR'];

   //adds the info 
$query = mysql_query("INSERT INTO comments (author, content, postdate, nid, ip) VALUES('$name','$comment','$date','$id','$ip')");
    
   //complete now lets say 
     echo "<center>";
     echo "Comment added!";
     echo "<br><br>";
     echo "You will be redirected in 3 seconds";
  echo "<meta http-equiv='Refresh' content='3; URL=display.php?action=viewnews&id=$id'/>";
break;
  }
  ?>


i woulda put in paste bin if it worked

If you could help me thanks and all in advance
mathiaus
Pastebin has worked again for some time
http://frihost.pastebin.com/708791

Line 106 isnt ended (no Wink
$date = date(d,m,y)
DanielXP
yer asked a boy on msn missed a ;
Related topics
Fatal PHP error
[PHP] Error link
php error ?[parse error]
suddenly a php error on my website
PHP Error Pages
[RESOLVED] PHP Error
MySQL/PHP Error..
PHP error
Php error
[help=html,php]Error en forma de contacto...
PHP error page, die()
Error pages
PHP error reporting
XML/XHTML header problem
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.