Jump to content

Unexpected $end

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Ricardo-san

Ricardo-san

    Learning Programmer

  • Members
  • PipPipPip
  • 53 posts
Can't really figure out what's causing this error:
Parse error: syntax error, unexpected $end in /localhost/temp/mode_home.php on line 140

And my code in mode_home.php:
<?php

if (!defined('IN_SITE')) {

	die('<body style="background-color:#FAFAFA;font-family:Verdana;font-size:12px;text-align:center;margin-top:25px;"><div style="margin:auto;text-align:left;border:2px #777 solid;width:750px;padding:10px;background-color:#FCFCFC;"><h2 style="margin:0px;color:#900;">Unauthorized.</h2>You are not allowed to view this file.</div></body>');

}

?>

                <div width="748" height="30" class="sub-nav-bg" valign="top"><div class="left"><strong> Welcome to <?= $site_name; ?></strong></div>

                  <div class="right">

					<?= get_dropdown(); ?>

                  </div></div>

		<?php include('templates/'. $template_dir .'/side.php'); ?>

		<!-- BEGIN MIDDLE COLUMN -->

		                    <div class="content">

                        <div class="Post">

                            <div class="Post-tl"></div>

                            <div class="Post-tr"><div></div></div>

                            <div class="Post-bl"><div></div></div>

                            <div class="Post-br"><div></div></div>

                            <div class="Post-tc"><div></div></div>

                            <div class="Post-bc"><div></div></div>

                            <div class="Post-cl"><div></div></div>

                            <div class="Post-cr"><div></div></div>

                            <div class="Post-cc"></div>

                            <div class="Post-body">

                        <div class="Post-inner">

                            <div class="PostMetadataHeader">

                                <h2 class="PostHeaderIcon-wrapper">

                                <img src="templates/bzombie/images/PostHeaderIcon.png" width="22" height="21" alt="PostHeaderIcon" /> <span class="PostHeader">Newest Games</span></h2></div>

					<div class="PostContent">

<?php

						$counter = 1;

						if (mysql_num_rows($result_newest)) {

							while($row = mysql_fetch_assoc($result_newest) ) {

								if (strlen($row['g_desc'])> 63) {

              						$row['g_desc'] = substr($row['g_desc'],0,63).' ...';

								}

								if (empty($row['g_iconname'])) { $row['g_iconname'] = 'noicon.gif'; }

								if($counter == 1) { echo '<tr>'; }

					?>

                      <td width="270" valign="top" class="content"><a href="<?= get_game_link($row['g_name']); ?>"><img src="<?= $row['g_iconname']; ?>" alt="<?= $row['g_name']; ?>" width="<?= $thumb_width; ?>" height="<?= $thumb_height; ?>" border="0"></a><strong><a href="<?= get_game_link($row['g_name']); ?>"><?= $row['g_name'] ?></a></strong><br>

                        <p><?= $row['g_desc']; ?></p>

                        <span><?= number_format($row['g_totalplays']); ?> Total Plays | <?= date('M jS',$row['g_date']); ?></span><br /></td>

					<tr>

                      <td colspan="2" class="content"><h2>Most Popular Games</h2></td>

                    </tr>

					<?php

						$counter = 1;

						if (mysql_num_rows($result_populor)) {

							while($row = mysql_fetch_assoc($result_populor) ) {

								if (strlen($row['g_desc'])> 63) {

              						$row['g_desc'] = substr($row['g_desc'],0,63).' ...';

								}

								if (empty($row['g_iconname'])) { $row['g_iconname'] = 'noicon.gif'; }

								if($counter == 1) { echo '<tr>'; }

					?>

                      <td width="270" valign="top" class="content"><a href="<?= get_game_link($row['g_name']); ?>"><img src="<?= $row['g_iconname']; ?>" alt="<?= $row['g_name']; ?>" width="<?= $thumb_width; ?>" height="<?= $thumb_height; ?>" border="0"></a><strong><a href="<?= get_game_link($row['g_name']); ?>"><?= $row['g_name'] ?></a></strong><br>

                        <p><?= $row['g_desc']; ?></p>

                        <span><?= number_format($row['g_totalplays']); ?> Total Plays | <?= date('M jS',$row['g_date']); ?></span></td>

					<?php

								if($counter == 2) {

									$counter = 0;

									echo '</tr>';

								}

							++$counter;

							}

						}

						else {

							echo '<td valign="top" class="content">Sorry, No Games To Show</td>';

						}

					?>

                    <tr>

                      <td colspan="2" valign="top" class="list">

<table>

               <?php

                  $counter = 1;

                  echo '<tr>';

                  $sql = 'SELECT * FROM '. $table_categories .'

                        WHERE cat_status = 1';

                  $result_outer = do_mysql_query($sql);


                  while($row_cat = mysql_fetch_assoc($result_outer)) {

                  

                     $sql = 'SELECT * FROM '. $table_games .'

                           WHERE g_status = 1

                              AND g_category = '. $row_cat['cat_id'] .'

                           LIMIT '. $games_home_limit .'';

                     $result_inner = do_mysql_query($sql);

               ?>

                  <td valign="top">

                          <h3><?= $row_cat['cat_name'] ?> <a href="<?= get_browse_link($row_cat['cat_name']); ?>">»</a></h3>

                          <ul>

                  <?php

                     if (mysql_num_rows($result_inner)) {

                        while($row = mysql_fetch_assoc($result_inner)) {

                  ?>

                            <li><table><tr><td><?= ($row['g_totalplays'] >= 1000) ? ' class="hot"' : ''; ?><a href="<?= get_game_link($row['g_name']) ?>"><img src="<?= $row['g_iconname']; ?>" alt="<?= $row['g_name']; ?>" title="<?= $row['g_name']; ?>" width="25" height="25" border="0"></a></td><td><a href="<?= get_game_link($row['g_name']) ?>"><?= $row['g_name'] ?></a></td></tr></table></li>

                  <?php

                        }

                  ?>

                          </ul>

                          <a href="<?= get_browse_link($row_cat['cat_name']); ?>" class="viewmore">» View More</a><br /><br />


                  <?php

                     }

                     else {

                        echo '<li>No Games</li>';

                     }

                  ?>

                  </td>

               <?php

                     if($counter == 3) { echo '</tr>'; }

                     if($counter == 6) { echo '</tr>'; }

                     if($counter == 9) { echo '</tr>'; }

                     if($counter == 12) { echo '</tr>'; }

                     if($counter == 15) { echo '</tr>'; }

                     ++$counter;

                  }

               ?>

</table></td>

                    </tr>

                  </table>

                                              </div>

                            <div class="cleared"></div>

				  <!-- END MIDDLE COLUMN -->

				  </td>

              </tr>

            </table></td>

            </tr>
Any help would be appreciated. TIA.

#2
mikelbring

mikelbring

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
You probably forgot a } somewhere

Realize the Web Web services and design.


#3
Guest_Jaan_*

Guest_Jaan_*
  • Guests
<?php
if (!defined('IN_SITE')) {
    die('<body style="background-color:#FAFAFA;font-family:Verdana;font-size:12px;text-align:center;margin-top:25px;"><div style="margin:auto;text-align:left;border:2px #777 solid;width:750px;padding:10px;background-color:#FCFCFC;"><h2 style="margin:0px;color:#900;">Unauthorized.</h2>You are not allowed to view this file.</div></body>');
}
?>
                <div width="748" height="30" class="sub-nav-bg" valign="top"><div class="left"><strong> Welcome to <?= $site_name; ?></strong></div>
                  <div class="right">
                    <?= get_dropdown(); ?>
                  </div></div>
        <?php include('templates/'. $template_dir .'/side.php'); ?>
        <!-- BEGIN MIDDLE COLUMN -->
                            <div class="content">
                        <div class="Post">
                            <div class="Post-tl"></div>
                            <div class="Post-tr"><div></div></div>
                            <div class="Post-bl"><div></div></div>
                            <div class="Post-br"><div></div></div>
                            <div class="Post-tc"><div></div></div>
                            <div class="Post-bc"><div></div></div>
                            <div class="Post-cl"><div></div></div>
                            <div class="Post-cr"><div></div></div>
                            <div class="Post-cc"></div>
                            <div class="Post-body">
                        <div class="Post-inner">
                            <div class="PostMetadataHeader">
                                <h2 class="PostHeaderIcon-wrapper">
                                <img src="templates/bzombie/images/PostHeaderIcon.png" width="22" height="21" alt="PostHeaderIcon" /> <span class="PostHeader">Newest Games</span></h2></div>
                    <div class="PostContent">
<?php
                        $counter = 1;
                        if (mysql_num_rows($result_newest)) {
                            while($row = mysql_fetch_assoc($result_newest) ) {
                                if (strlen($row['g_desc'])> 63) {
                                      $row['g_desc'] = substr($row['g_desc'],0,63).' ...';
                                }
                                if (empty($row['g_iconname'])) { $row['g_iconname'] = 'noicon.gif'; }
                                if($counter == 1) { echo '<tr>'; }
                    ?>
                      <td width="270" valign="top" class="content"><a href="<?= get_game_link($row['g_name']); ?>"><img src="<?= $row['g_iconname']; ?>" alt="<?= $row['g_name']; ?>" width="<?= $thumb_width; ?>" height="<?= $thumb_height; ?>" border="0"></a><strong><a href="<?= get_game_link($row['g_name']); ?>"><?= $row['g_name'] ?></a></strong><br>
                        <p><?= $row['g_desc']; ?></p>
                        <span><?= number_format($row['g_totalplays']); ?> Total Plays | <?= date('M jS',$row['g_date']); ?></span><br /></td>
                    <tr>
                      <td colspan="2" class="content"><h2>Most Popular Games</h2></td>
                    </tr>
                    <?php
                        $counter = 1;
                        if (mysql_num_rows($result_populor)) {
                            while($row = mysql_fetch_assoc($result_populor) ) {
                                if (strlen($row['g_desc'])> 63) {
                                      $row['g_desc'] = substr($row['g_desc'],0,63).' ...';
                                }
                                if (empty($row['g_iconname'])) { $row['g_iconname'] = 'noicon.gif'; }
                                if($counter == 1) { echo '<tr>'; }
                    ?>
                      <td width="270" valign="top" class="content"><a href="<?= get_game_link($row['g_name']); ?>"><img src="<?= $row['g_iconname']; ?>" alt="<?= $row['g_name']; ?>" width="<?= $thumb_width; ?>" height="<?= $thumb_height; ?>" border="0"></a><strong><a href="<?= get_game_link($row['g_name']); ?>"><?= $row['g_name'] ?></a></strong><br>
                        <p><?= $row['g_desc']; ?></p>
                        <span><?= number_format($row['g_totalplays']); ?> Total Plays | <?= date('M jS',$row['g_date']); ?></span></td>
                    <?php
                                if($counter == 2) {
                                    $counter = 0;
                                    echo '</tr>';
                                }
                            ++$counter;
                            }
                        }
                        else {
                            echo '<td valign="top" class="content">Sorry, No Games To Show</td>';
                        }
                    ?>
                    <tr>
                      <td colspan="2" valign="top" class="list">
<table>
               <?php
                  $counter = 1;
                  echo '<tr>';
                  $sql = 'SELECT * FROM '. $table_categories .'
                        WHERE cat_status = 1';
                  $result_outer = do_mysql_query($sql);

                  while($row_cat = mysql_fetch_assoc($result_outer)) {
                  
                     $sql = 'SELECT * FROM '. $table_games .'
                           WHERE g_status = 1
                              AND g_category = '. $row_cat['cat_id'] .'
                           LIMIT '. $games_home_limit .'';
                     $result_inner = do_mysql_query($sql);
               ?>
                  <td valign="top">
                          <h3><?= $row_cat['cat_name'] ?> <a href="<?= get_browse_link($row_cat['cat_name']); ?>">»</a></h3>
                          <ul>
                  <?php
                     if (mysql_num_rows($result_inner)) {
                        while($row = mysql_fetch_assoc($result_inner)) {
                  ?>
                            <li><table><tr><td><?= ($row['g_totalplays'] >= 1000) ? ' class="hot"' : ''; ?><a href="<?= get_game_link($row['g_name']) ?>"><img src="<?= $row['g_iconname']; ?>" alt="<?= $row['g_name']; ?>" title="<?= $row['g_name']; ?>" width="25" height="25" border="0"></a></td><td><a href="<?= get_game_link($row['g_name']) ?>"><?= $row['g_name'] ?></a></td></tr></table></li>
                  <?php
                        }
                  ?>
                          </ul>
                          <a href="<?= get_browse_link($row_cat['cat_name']); ?>" class="viewmore">» View More</a><br /><br />

                  <?php
                     }
                     else {
                        echo '<li>No Games</li>';
                     }
                  ?>
                  </td>
               <?php
                     if($counter == 3) { echo '</tr>'; }
                     if($counter == 6) { echo '</tr>'; }
                     if($counter == 9) { echo '</tr>'; }
                     if($counter == 12) { echo '</tr>'; }
                     if($counter == 15) { echo '</tr>'; }
                     ++$counter;
                  }
                  
               }
               
			}
               ?>
</table></td>
                    </tr>
                  </table>
                                              </div>
                            <div class="cleared"></div>
                  <!-- END MIDDLE COLUMN -->
                  </td>
              </tr>
            </table></td>
            </tr>

It should work now..
You have missed 2 }