I have a website that is working fine on a remote server.

I have set up a testing server on my local machine. PHP admin, the database and everything seems to be working fine.

However when I open the website locally I get the following error

Parse error: syntax error, unexpected $end in E:\wamp\www\soccerwebs08\wildones\index.php on line 255

However there is no code on line 255, all of the code ends at line 253.

I read on one thread that it may be a problem with curly brackets but I dont think thats the problem because as I mentioned the website is working fine on a remote server. I also read that I may have to change one piece of code on a PHP.INI file however I cant find this file anywhere, could it be called something else?

Other pages do show up but have some of the code displayed. I'm not sure if this is a related or seperate problem. I've attched a picture of this problem.

If anyone has any ideas what may be the problem I would really appreciate a reply.

Thanks
Camster

    Could be a missing or incorrect include file, perhaps? In any case, there's no way for us to tell without the code.

      <html>
      <head>
      <title>Soccer Team Websites</title>
      <meta name="description" content="">
      <meta name="keywords" content="">
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      
      <link href="master.css" rel="stylesheet" type="text/css">
      
      <script language="JavaScript" type="text/JavaScript">
      <!--
      function MM_openBrWindow(theURL,winName,features) { //v2.0
        window.open(theURL,winName,features);
      }
      //-->
      </script>
      </head>
      <?php
      	include "../connections/db.php";
      	$TID = getTID();
      	$dirs= explode("/",dirname($_SERVER['SCRIPT_NAME']));
      	$sdir=$dirs[count($dirs)-1];
      	$mainimage=="";
      	function getcount($gid,$tablename) {
      		$sqlfun="select count(*) as cnt from $tablename where g_id='$gid'";
      		$rsfun=mysql_query($sqlfun);
      		$resfun=mysql_fetch_object($rsfun);
      		return $resfun->cnt;
      	}
      
      function imageSize($w,$h,$dest_x,$dest_y) {
      	if($w>$dest_x || $h>$dest_y)
      	{
      		$XRatio=(real)($dest_x/$w);
      		$YRatio=(real)($dest_y/$h);
      		$Ratio=min($XRatio,$YRatio);
      		$nw=round($w*$Ratio);
      		$nh=round($h*$Ratio);
      	}
      	else
      	{
      		$nw = $w;
      		$nh = $h;
      	}
      	return "width='$nw' height='$nh'";
      }
      
      function nextgame() {
      global $TID;
      	$date=date("Y-m-d");
      	$sql="select * from mschedule where TID='$TID' and MDate>='$date' order by mdate limit 1";
      	//echo $sql;
      	$rs=mysql_query($sql);
      	if(mysql_num_rows($rs)>0) {
      		$dirs= explode("/",dirname($_SERVER['SCRIPT_NAME']));
      		$sdir=$dirs[count($dirs)-1];
      		$res=mysql_fetch_object($rs);
      		echo $res->MDate."<BR>";
      		echo $sdir. " Vs <br>";
      		echo $res->Opponent;
      	} else {
      		echo "No Schedule";
      	}
      }
      
      function eventfuncs($id) {
      	$date=date("Y-m-d");
      	$sql="select * from events where TID='$id' and EDate>='$date' order by EDate desc limit 5";
      	$rs=mysql_query($sql);
      	if(mysql_num_rows($rs)>0) {
      		while($res=mysql_fetch_object($rs)) {
      		?>
      			<span class="arial11k"> <?=$res->EDate?></span><br>
      			<span class="arial12kb"><?=$res->EvTitle?></span>
      			<span class="arial11k"><br><?=nl2br($res->Location)?></span>
      			<span class="arial12kb"><?=$res->EvDesc?></span>
      			<br><br>
      			<?
      		}
      	} else {
      		echo "No Events";
      	}
      }
      
      function storyfunc($type,$id) {
      	$sql="select * from stories where TID='$id' and story_type='$type' order by story_date desc limit 1";
      	$rs=mysql_query($sql);
      	if(mysql_num_rows($rs)>0) {
      		global $mainimage,$story_date,$story_header,$story_body,$stid;
      		while($res=mysql_fetch_object($rs)) {
      			if($type=="1") {
      				$mainimage=$res->main_image;
      				$story_date=$res->story_date;
      				$story_header=$res->story_header;
      				$story_body=$res->story_body;
      				$stid=$res->Story_ID;
      			} else {
      				$stsid=$res->Story_ID;
      			?>
      				<span class="arial11ki"><?=$res->story_date?></span><br>
      				<span class="arial14kb"><?=$res->story_header?></span>
      				<span class="home"><br><br><?=substr($res->story_body,0,500)?><br>
      				<? if(strlen($res->story_body)>250) { ?><br><span class="arial11ki"><a href="stories.php?stid=<?=$stsid?>">.....continued</a></span><? } ?>
      			<?
      			}
      		}
      	} else {
      		echo "No News";
      	}
      }
      ?>
      
      
      <body>
      <br>
      <table width="776" height="507" border="0" align="center" cellpadding="0" cellspacing="0" class="mainbox">
        <tr>
          <td valign="top"><table width="776" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><img src="images/graphic_01.gif" width="775" height="90"></td>
            </tr>
            <tr>
              <td height="23" background="images/graphic_02.gif"><? include "header.php"; ?></td>
            </tr>
            <tr>
              <td class="mainbkgnd"><table width="776" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="23" valign="top">&nbsp;</td>
                  <td width="726" valign="top"><table width="100%"  border="0" align="center" cellpadding="1" cellspacing="0">
                    <tr>
                      <td> <table width="80"  border="0" align="right" cellpadding="2" cellspacing="0" bgcolor="#000000">
                            <tr>
                              <td bgcolor="#666666" class="tablebkgnd">
                                <div align="center"><a href="../team_login.php" class="arial11wb">Team Login</a> </div></td>
                            </tr>
                          </table></td>
                    </tr>
                    <tr>
                      <td height="444" valign="top"><div align="center">
                        <table width="100%"  border="0" cellpadding="1" cellspacing="8" class="mainbox">
                          <tr>
                            <td width="21%" height="407" valign="top" class="tablebkgnd"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td valign="top"><table width="100%" height="105"  border="0" cellpadding="4" cellspacing="0">
                                  <tr>
      								<?
      									$sqlgames="select * from games where TID='$TID' and status='1' order by Game_date desc limit 1";
      									$rsgames=mysql_query($sqlgames);
      									if(mysql_num_rows($rsgames)>0)
      									{
      										$resgames=mysql_fetch_object($rsgames);
      								?>
                                    	<td height="48" class="columnhead"><span class="arial11wb">Last Game</span><br>
            								<?=$sdir?> <?=$totgls=getcount($resgames->g_id,"game_goals");?><br>
            								<?=$resgames->Game_Opp?> <?=$totopgls=getcount($resgames->g_id,"opponent_goals")?> </td>
      	 							</td>
      	 								<?
      	  								} else {
      	  								?>
      								<td height="48" class="columnhead"><span class="arial11wb">Last Game</span><br>
            							No Info
      								</td>
      	 							<?
      	  								}
      	  							?>
                                  </tr>
                                  <tr>
                                    <td height="48" class="columnhead"><span class="arial11wb">Next Game <br>
                                          <span class="arial11k"><?=nextgame();?></span>
                                    </div></td>
                                  </tr>
                                </table></td>
                              </tr>
                              <tr>
                                <td valign="top"><table width="100%" height="262"  border="0" cellpadding="4" cellspacing="0">
                                  <tr>
                                    <td height="254" valign="top"><div align="center">
                                      <span class="arial11wb">Events</span><br>
      								<?=eventfuncs($TID)?>
                                      <span class="arial11wb">Archives</span><br>
      								<?
      									$sql="select * from stories where TID='$TID' order by story_date desc limit 5";
      									$rs=mysql_query($sql);
      									$numrows=mysql_num_rows($rs);
      									while($res=mysql_fetch_object($rs)) {
      	    					    ?>
                                          <span class="arial11k"><?=$res->story_date?><br></span>
                                          <span class="arial11k"><a href="stories.php?stid=<?=$res->Story_ID?>"><?=$res->story_header?></a>
                                          </span><span class="arial11k"><br></span>
      								<?
      								}
      								?>
      								<span class="arial11k"><a href="stories.php?view=all">View All...</a></span>
      								</div>
      								</td>
                                  </tr>
                                </table></td>
                              </tr>
                            </table></td>
                            <td width="60%" valign="top">
      					  	<table width="100%"  border="0" cellspacing="0" cellpadding="1">
                              <tr>
                              </tr>
                              <tr>
      							<td>
      								<div align="left">
      								  <?
      									storyfunc(1, $TID);
      									list($width, $height, $type, $attr) = getimagesize($mainimage);
      									$size = imageSize($width,$height,300,200);
      								?>
      								  <table width="60%"  border="0" cellpadding="4" cellspacing="0" class="mainbox">
      								    <tr>
      								      <td><div align="center"><img src="<?=$mainimage?>" <?=$size?> class="floatCenter"></div></td>
                                		  </tr>
      								    </table>
      								  <span class="arial11ki">
      							      <?=$story_date?>
      							      </span><span class="arial14kb"><br>
      							      <br>
      								      <b>
      							          <?=$story_header?>
      						          </b></span><span class="home"><br>
      								  <br>
      								  <?=nl2br(substr($story_body,0,800))?>
      						        </div></td>
                              </tr>
                            	</table>
                              <? if(strlen($story_body)>800) { ?>
      							<span class="home"> </span><span class="arial11ki"><a href="stories.php?stid=<?=$stid?>">.....continued</a></span>
      						<? } ?>
      					</td>
                          <td width="2%" valign="top" class="vrule">&nbsp;</td>
                          <td width="17%" valign="top">
      						<span class="home"><?=storyfunc(0,$TID);?></span>
      					</td>
                        </tr>
                        </table>
                        </div></td>
                    </tr>
                  </table></td>
                  <td width="27" valign="top"><div align="left"></div></td>
                </tr>
              </table></td>
            </tr>
            <? include "footer.php"; ?>
          </table></td>
        </tr>
      </table>
      <div align="center"><a href="#"><span class="arial11kb" onClick="MM_openBrWindow('http://www.soccerwebs.net','Soccerwebs','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=820,height=680')">Powered By Soccerwebs.net</span></a></div>
      </body>
      </html>
      

        Perhaps the new host does not have the short_open_tag option enabled. If this is the case, you need to change your "<?" tags to "<?php" tags and change "<?=" to "<?php echo".

        PS: You could run a quick test file as follows to see what the setting is:

        <?php
        echo ini_get('short_open_tag');
        ?>
        

          Gave it a try and now i get a different error

          Parse error: syntax error, unexpected T_ELSE in E:\wamp\www\soccerwebs08\cyclones\index.php on line 134

          Line 134 is this on the above code, I've placed line numbers to the left for reference only

          131	<?php
          132			}
          133		}
          134	} else {
          135		echo "No News";

          }
          }
          ?>

          Thanks
          Cam

            5 days later

            If you're still having an issue with this, post your code for us to examine (if it's too long for a post, attach it in a .txt file).

              Write a Reply...