I am receiving the following error message on my home page:
Parse error: syntax error, unexpected T_VARIABLE in /home/prospec7/public_html/index.php on line 1

And the following code -- I apologize for it being tough to read, but I am a complete novice and this is how it shows up in my index.php file -- though I do not remember it always appearing this way.


<?phpsession_start();include("localSettings.php");include("connect.php");include("body_include.php");?><CENTER><TITLE>Prospect Insider - prospects, scouting and the draft</TITLE><HEAD><link rel="stylesheet" type="text/css" href="main.css"><link rel="alternate" type="application/rss+xml" title="Prospect Insider RSS Feed" href="/rss.xml" /></head><?php include ("banner.php"); ?><DIV CLASS="menubar"><center><?php include ("menubar.php"); ?></center></DIV><DIV CLASS="page"><SPAN CLASS="main"><?php$main_content_qu = mysql_query("select * from content where a_order=0");while ($main_content_res = mysql_fetch_array($main_content_qu)){  $post_year = substr($main_content_res['date'],0,4);  $post_month = substr($main_content_res['date'],5,2);  $post_day = substr($main_content_res['date'],8,2);    $combo_date = $post_month ."-". $post_day ."-". $post_year;  echo "<CENTER><strong><DIV CLASS=\"bluebarbig2\"><A HREF=\"/view/". $main_content_res['slug'] ."/\">". $main_content_res['title'] ."</A></DIV></strong></CENTER><DIV CLASS=\"article-space\"><br \></DIV>";  echo "<DIV CLASS=\"article-space\"><TABLE width=100%><TR><TD WIDTH=40% ALIGN=\"left\"><b><i><FONT COLOR=\"#000333\"><FONT SIZE=\"2\">By ". $main_content_res['author'] ."</FONT></i></b></strong></TD><TD WIDTH=20% ALIGN=\"left\"><IMG SRC=\"TopStory10.jpg\"></TD><TD WIDTH=40% ALIGN=\"center\"><i><b><font color=\"#000333\"><FONT SIZE=\"2\">". $combo_date ."</FONT></i></b></strong></TD></TR></TR></TABLE><br \>";  echo "</DIV>";  $char_count = strlen($main_content_res['content']);  $comment_qu = mysql_query("select comment_id from comments where blog_id =". $main_content_res['content_id']);  $num_comments = mysql_num_rows($comment_qu);  if ($char_count > $main_content_res['cutoff'])  {    $short_content = substr($main_content_res['content'],0,$main_content_res['cutoff']);    $format_content = trim($short_content);    echo $format_content ."...<br \>";    echo "<br \><A HREF=\"/view/". $main_content_res['slug'] ."/\">Full Story</A> - <A HREF=\"/view/". $main_content_res['slug'] ."/#comments\">Discuss (". $num_comments .")</A><br \>";    ?>    <br \>    <?php  } else {    echo $main_content_res['content'] ." <br \><br \>";    echo "<br \><A HREF=\"/view/". $main_content_res['slug'] ."#comments\">Discuss (". $num_comments .")</A>";    ?>    <br \><br \>        <?php  }  ?><br \><CENTER></CENTER><?php}echo "<br \>";$content_qu = mysql_query ("select * from content where a_order >0 order by a_order asc limit 8");echo "<TABLE width=100% CELLSPACING=5><TR>";$counter=0;while ($content_res = mysql_fetch_array($content_qu)){  $counter++;  $post_year = substr($content_res['date'],0,4);  $post_month = substr($content_res['date'],5,2);  $post_day = substr($content_res['date'],8,2);    $combo_date = $post_month ."-". $post_day ."-". $post_year;  echo "<TD CLASS=\"standard\" VALIGN=\"top\" ALIGN=\"left\" WIDTH=50%>";  echo "<CENTER><strong><DIV CLASS=\"bluebarbig\"><A HREF=\"/view/". $content_res['slug'] ."/\">". $content_res['title'] ."</A></DIV></strong></CENTER><DIV CLASS=\"article-space\"><br \></DIV>";  echo "<DIV CLASS=\"article-space\"><TABLE WIDTH=100%><TR><TD WIDTH=40% ALIGN=\"left\">";  echo "<i><b><FONT COLOR=\"#000333\"><FONT SIZE=\"2\">By ". $content_res['author'] ."</FONT></b></i>";  echo "</TD><TD WIDTH=40% ALIGN=\"right\"><i><b><font color=\"#000333\"><FONT SIZE=\"2\">". $combo_date ."</font></i></b></TD></TR></TABLE><br \></DIV>";  $char_count = strlen($content_res['content']);  $comment_qu = mysql_query("select comment_id from comments where blog_id =". $content_res['content_id']);  $num_comments = mysql_num_rows($comment_qu);  if ($char_count > $content_res['cutoff'])  {    $short_content = substr($content_res['content'],0,$content_res['cutoff']);    $format_content = trim($short_content);    echo $format_content ."...<br \>";    echo "<br \><A HREF=\"/view/". $content_res['slug'] ."/\">Full Story</A> - <A HREF=\"/view/". $content_res['slug'] ."/#comments\">Discuss (". $num_comments .")</A>";    ?>     <br \><br \>       <?php  } else {    echo $content_res['content'] ." <br \><br \>";    echo "<br \><A HREF=\"/view/". $content_res['slug'] ."/#comments\">Discuss (". $num_comments .")</A>";    ?>    <br \><br \>         <?php  }  echo "<br \>";  echo "</TD>";    if ($counter == 2)  {    echo "</TR></TD>";    $counter = 0;  }}echo "</TABLE>";echo "<br \><A HREF=\"archive.php\">Previous Reports</A><br \>";?></SPAN><SPAN CLASS="columnleft"><?php include ("left_sidebar.php"); ?></SPAN><SPAN CLASS="columnright"><?php include ("right_sidebar.php"); ?></SPAN></DIV><?php  $gu_siteid="xnj6ttk";$gu_param = "st=".$gu_siteid."&ref=".urlencode($_SERVER['HTTP_REFERER'])."&vip=".$_SERVER['REMOTE_ADDR']."&ua=".urlencode($_SERVER['HTTP_USER_AGENT'])."&cur=".urlencode("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])."&b=5";@readfile("http://counter.goingup.com/phptrack.php?".$gu_param); ?></BODY></CENTER>
7 Years
Discussion Span
Last Post by webexpertzhere

<?phpsession_start(); Should be: <?php session_start(); There are also some html problems in your code, e.g. <br \> should be <br />


Thanks... I fixed the phpsession start error, and all the br's... is there anything else in there that might render me that error? Because it's still occuring.

More html issues, other more technical issues?


Couldn't find any more php errors on first glance. Format your code nicely and try again, then you get at least a more specific line number.

Edited by pritaeas: n/a


Place your code one in each line, provide spaces wherever necessary. There seem to be other places also where <?php and the next character is not provided a space like <?php} should be <?php }
So check your code thoroughly for required spaces, split your code into multiple lines and try again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.