Page 1 of 1

Parse error: syntax error, unexpected T_ELSE in

Posted: Mon Feb 23, 2009 7:31 am
by johnworf
hi,

i want to add in different colors to the rows and the thing works fine when there are records but doesn't when there are none - as i get a table headings...
Parse error: syntax error, unexpected T_ELSE in /home/allresta/public_html/Alabama/alabaster.php on line 106

Code: Select all

 
<?php
// technocurve arc 3 php bv block1/3 start
$color1 = "#99cc33";
$color2 = "#ccff99";
$color = $color1;
// technocurve arc 3 php bv block1/3 end
?><?php require_once('../Connections/myconn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
mysql_select_db($database_myconn, $myconn);
$query_Recordset1 = "SELECT Restaurant, Website, `Description`, URL FROM Alabama WHERE URL = 'http://www.foo-bar.com/Alabama/alabaster.php' ORDER BY Restaurant ASC";
$Recordset1 = mysql_query($query_Recordset1, $myconn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Alabaster Restaurants</title>
<meta name="keywords" content="Alabaster Restaurants" />
<meta name="description" content="Find a restaurant inAlabaster;the US state of Alabama Why not add your restaurant to the list?" />
<link href="../style/usa.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- start header -->
<div id="header">
    <div id="logo">
      <h1><a href="#">foo-bar.com</a></h1>
  </div>
<div id="menu">
        <ul>
            <li><a href="http://www.foo-bar.com/index.html">Home</a></li>
            <li><a href="http://www.foo-bar.com/restaurant-articles/index.php">Restaurant Articles</a></li>
            <li><a href="http://www.foo-bar.com/recipes/index.php">Recipes</a></li>
        </ul>
    </div>
</div>
<div id="headerbg" align="center"><span style="white-space: nowrap" margin-top: "20px"><img src="../state-images/alabama.jpg" alt="state of alabama"><img src="../recipes/images/main-meals.jpg" width="450" height="209" /></span></div>
<div id="page">
    <!-- start content -->
    <div id="content">
        <!-- start latest-post -->
        <div id="latest-post" class="post">
            <h1 class="title">Alabaster Restaurants</h1>
<div class="entry">
<?php 
if ( $totalRows_Recordset1 > 0 ) {
echo '<table width="580" border="0" cellspacing="0" cellpadding="0"><tr><td><h2>Restaurant</h2></td><td><h2>Description</h2></td><td><h2>Report</h2></td></tr>';?>
 
          <?php do {  ?>
          <tr <?php 
// technocurve arc 3 php bv block2/3 start
echo " style=\"background-color:$color\"";
// technocurve arc 3 php bv block2/3 end
?>>
            <td><a href="http://<?php echo $row_Recordset1['Website']; ?>" target="_blank" rel="nofollow"><?php echo $row_Recordset1['Restaurant']; ?></a></td>
            <td><?php echo $row_Recordset1['Description']; ?></td>
            <td><a href="mailto:reportabuse@foo-bar.com?subject=<?php echo $row_Recordset1['URL']; ?>">Report Abuse</a></td>        
          </tr>
          <?php 
// technocurve arc 3 php bv block3/3 start
if ($color == $color1) {
    $color = $color2;
} else {
    $color = $color1;
}
// technocurve arc 3 php bv block3/3 end
?>
 
            <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<?php echo '</table>'; ?>
<?php echo '<p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Alabaster?</p>'; ?>;
 
 
<?php } ?>
<?php else {   ?>
        <?php echo '<p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Alabaster?</p>'; ?>;
        <?php }?>
  </div>
      </div>
    <!-- end latest-post -->
        <!-- start recent-posts -->
        <div id="recent-posts">
            <div class="post">
                <h2 class="title">Restaurant Articles</h2>
                <p>Buying A Restaurant</p>
              <div class="entry">
            <p><a href="../restaurant-articles/buying-a-restaurant.php" class="more">Read more</a></p>
              </div>
            </div>
            <div class="post">
                <h2 class="title">Recipe</h2>
                <p>Cajun Chicken Wings</p>
              <div class="entry">
            <p><a href="http://www.foo-bar.com/recipes/cajun-chicken-wings.php" class="more">Read more</a></p>
              </div>
            </div>
            <div class="post">
                <h2 class="title">Business Plan</h2>
                <p>Seafood Restaurant</p>
              <div class="entry">
            <p><a href="http://www.businessplanning-4-you.com/business-plans/Seafood-Restaurant-Business-Plan.html" class="more">Read more</a></p>
              </div>
            </div>
            </div>
        <!-- end recent-posts -->
    </div>
    <!-- end content -->
    <!-- start sidebar -->
    <div id="sidebar">
        <ul>
            <li>
                <ul>
                    <li><a href="http://www.foo-bar.com/Alabama/index.php">Alabama</a></li>
                    <li><a href="http://www.foo-bar.com/Alaska/index.php">Alaska</a></li>
                    <li><a href="http://www.foo-bar.com/Arizona/index.php">Arizona</a></li>
                    <li><a href="http://www.foo-bar.com/Arkansas/index.php">Arkansas</a></li>
                    <li><a href="http://www.foo-bar.com/California/index.php">California</a></li>
                    <li><a href="http://www.foo-bar.com/Colorado/index.php">Colorado</a></li>
                    <li><a href="http://www.foo-bar.com/Connecticut/index.php">Connecticut</a></li>
                    <li><a href="http://www.foo-bar.com/Delaware/index.php">Delaware</a></li>
                    <li><a href="http://www.foo-bar.com/Florida/index.php">Florida</a></li>
                    <li><a href="http://www.foo-bar.com/Georgia/index.php">Georgia</a></li>
                    <li><a href="http://www.foo-bar.com/Hawaii/index.php">Hawaii</a></li>
                    <li><a href="http://www.foo-bar.com/Idaho/index.php">Idaho</a></li>
                    <li><a href="http://www.foo-bar.com/Illinois/index.php">Illinois</a></li>
                </ul>
            </li>
            <li>
          <ul>
                    
                    <li><a href="http://www.foo-bar.com/Indiana/index.php">Indiana</a></li>
                    <li><a href="http://www.foo-bar.com/Iowa/index.php">Iowa</a></li>
                    <li><a href="http://www.foo-bar.com/Kansas/index.php">Kansas</a></li>
                    <li><a href="http://www.foo-bar.com/Kentucky/index.php">Kentucky</a></li>
                    <li><a href="http://www.foo-bar.com/Louisiana/index.php">Louisiana</a></li>
                    <li><a href="http://www.foo-bar.com/Maine/index.php">Maine</a></li>
                    <li><a href="http://www.foo-bar.com/Maryland/index.php">Maryland</a></li>
                    <li><a href="http://www.foo-bar.com/Massachusetts/index.php">Massachusetts</a></li>
                    <li><a href="http://www.foo-bar.com/Michigan/index.php">Michigan</a></li>
                    <li><a href="http://www.foo-bar.com/Minnesota/index.php">Minnesota</a></li>
                    <li><a href="http://www.foo-bar.com/Mississippi/index.php">Mississippi</a></li>
                    <li><a href="http://www.foo-bar.com/Missouri/index.php">Missouri</a></li>
                    <li><a href="http://www.foo-bar.com/Montana/index.php">Montana</a></li>
              </ul>
            </li>
      <li>
                
                <ul>
                    
                    <li><a href="http://www.foo-bar.com/Nebraska/index.php">Nebraska</a></li>
                    <li><a href="http://www.foo-bar.com/Nevada/index.php">Nevada</a></li>
                    <li><a href="http://www.foo-bar.com/New-Hampshire/index.php">New Hampshire</a></li>
                    <li><a href="http://www.foo-bar.com/New-Jersey/index.php">New Jersey</a></li>
                    <li><a href="http://www.foo-bar.com/New-Mexico/index.php">New Mexico</a></li>
                    <li><a href="http://www.foo-bar.com/New-York/index.php">New York</a></li>
                    <li><a href="http://www.foo-bar.com/North-Carolina/index.php">North Carolina</a></li>
                    <li><a href="http://www.foo-bar.com/North-Dakota/index.php">North Dakota</a></li>
                    <li><a href="http://www.foo-bar.com/Ohio/index.php">Ohio</a></li>
                    <li><a href="http://www.foo-bar.com/Oklahoma/index.php">Oklahoma</a></li>
                    <li><a href="http://www.foo-bar.com/Oregon/index.php">Oregon</a></li>
                    <li><a href="http://www.foo-bar.com/Pennsylvania/index.php">Pennsylvania</a></li>
                </ul>
          </li>
            <li>
              <ul>
                    
                    <li><a href="http://www.foo-bar.com/Rhode-Island/index.php">Rhode Island</a></li>
                    <li><a href="http://www.foo-bar.com/South-Carolina/index.php">South Carolina</a></li>
                    <li><a href="http://www.foo-bar.com/South-Dakota/index.php">South Dakota</a></li>
                    <li><a href="http://www.foo-bar.com/Tennessee/index.php">Tennessee</a></li>
                    <li><a href="http://www.foo-bar.com/Texas/index.php">Texas</a></li>
                    <li><a href="http://www.foo-bar.com/Utah/index.php">Utah</a></li>
                    <li><a href="http://www.foo-bar.com/Vermont/index.php">Vermont</a></li>
                    <li><a href="http://www.foo-bar.com/Virginia/index.php">Virginia</a></li>
                    <li><a href="http://www.foo-bar.com/Washington/index.php">Washington</a></li>
                    <li><a href="http://www.foo-bar.com/West-Virginia/index.php">West Virginia</a></li>
                    <li><a href="http://www.foo-bar.com/Wisconsin/index.php">Wisconsin</a></li>
                    <li><a href="http://www.foo-bar.com/Wyoming/index.php">Wyoming</a></li>
              </ul>
          </li>
        </ul>
          </li>
        </ul>
      <div style="clear: both;">&nbsp;</div>
    </div>
  <!-- end sidebar -->
</div>
<!-- end page -->
<div id="footer">
    <p id="legal">&copy;2008 All Restaurants USA. All Rights Reserved.</p>
  <p id="links"><a href="http://www.foo-bar.com/index.php">Home</a>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; <a href="http://www.foo-bar.com/terms.php">Terms</a> &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; <a href="http://www.foo-bar.com/faq.php">FAQ</a> &nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.foo-bar.com/contact.php">Contact Us</a></p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
 

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Mon Feb 23, 2009 7:41 am
by papa
Which line is 106 ?

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Tue Feb 24, 2009 8:56 am
by johnworf
<?php else { ?>

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Tue Feb 24, 2009 9:04 am
by Eran
You are missing an opening curly bracket at the start of your while loop:

Code: Select all

while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) {

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Wed Feb 25, 2009 4:16 am
by johnworf
so i've added that line and i still get the same error

Code: Select all

 
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) {; ?>
 

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Wed Feb 25, 2009 4:48 am
by Eran
remove the ';' after the opening curly bracket..

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Wed Feb 25, 2009 8:55 am
by johnworf
no i get the same error

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Wed Feb 25, 2009 9:30 am
by susrisha
i think i figured it out.. you got an else statement in line 106. there is no matching if statement for that .. have a look again please..

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Wed Feb 25, 2009 9:35 am
by johnworf
i thought this was the if statement for that near the top...

if ( $totalRows_Recordset1 > 0 ) {

I'm bit of a newbie and struggle with how the code is put together - this is just so frustrating!

I'm guessing you are probably write though it's the way my code is put together that's probably throwing it out somewhere...i'm just not up to the job

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Wed Feb 25, 2009 9:44 am
by susrisha
ok now here is what i got when i placed the whole code in my editor. i changed only two things and the editor shows no error.. i am posting the snippet that i changed..

Code: Select all

 
<?php echo '<p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Alabaster?</p>;'; ?>
 
 
<?php }
else {   ?>
 
 
Its from line 101 to 106.. please do the code changes accordingly and let me know if it has solved..

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Wed Feb 25, 2009 11:02 am
by johnworf
unfortunately i get the same error.

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Thu Feb 26, 2009 5:40 am
by johnworf
Hi,

I don't know if it helps - but this was the code before...this will show records fine if there are any but also shows the table headers when there aren't records - so if anyone can adjust this code so that it works i would be grateful...

Code: Select all

 
<?php
// technocurve arc 3 php bv block1/3 start
$color1 = "#99cc33";
$color2 = "#ccff99";
$color = $color1;
// technocurve arc 3 php bv block1/3 end
?><?php require_once('../Connections/myconn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
mysql_select_db($database_myconn, $myconn);
$query_Recordset1 = "SELECT Restaurant, Website, `Description`, URL FROM Alabama WHERE URL = 'http://www.foo-bar.com/Alabama/alabaster.php' ORDER BY Restaurant ASC";
$Recordset1 = mysql_query($query_Recordset1, $myconn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Akka Restaurants</title>
<meta name="keywords" content="Akka Restaurants" />
<meta name="description" content="Find a restaurant inAkka;the US state of Alabama Why not add your restaurant to the list?" />
<link href="../style/usa.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- start header -->
<div id="header">
    <div id="logo">
      <h1><a href="#">foo-bar.com</a></h1>
  </div>
<div id="menu">
        <ul>
            <li><a href="http://www.foo-bar.com/index.html">Home</a></li>
            <li><a href="http://www.foo-bar.com/restaurant-articles/index.php">Restaurant Articles</a></li>
            <li><a href="http://www.foo-bar.com/recipes/index.php">Recipes</a></li>
        </ul>
    </div>
</div>
<div id="headerbg" align="center"><span style="white-space: nowrap" margin-top: "20px"><img src="../state-images/alabama.jpg" alt="state of alabama"><img src="../recipes/images/vegetables.jpg" width="450" height="209" /></span></div>
<div id="page">
    <!-- start content -->
    <div id="content">
        <!-- start latest-post -->
        <div id="latest-post" class="post">
            <h1 class="title">Akka Restaurants</h1>
<div class="entry">
  <table width="580" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><h2>Restaurant</h2></td>
            <td><h2>Description</h2></td>
            <td><h2>Report</h2></td>
          </tr>
          <?php do {  ?>
          <tr <?php 
// technocurve arc 3 php bv block2/3 start
echo " style=\"background-color:$color\"";
// technocurve arc 3 php bv block2/3 end
?>>
            <td><a href="http://<?php echo $row_Recordset1['Website']; ?>" target="_blank" rel="nofollow"><?php echo $row_Recordset1['Restaurant']; ?></a></td>
            <td><?php echo $row_Recordset1['Description']; ?></td>
            <td><a href="mailto:reportabuse@foo-bar.com?subject=<?php echo $row_Recordset1['URL']; ?>">Report Abuse</a></td>        
          </tr>
          <?php 
// technocurve arc 3 php bv block3/3 start
if ($color == $color1) {
    $color = $color2;
} else {
    $color = $color1;
}
// technocurve arc 3 php bv block3/3 end
?>
            <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
        </table>
        <p>&nbsp;</p>
        <p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Akka?</p>
  </div>
      </div>
    <!-- end latest-post -->
        <!-- start recent-posts -->
        <div id="recent-posts">
            <div class="post">
                <h2 class="title">Restaurant Articles</h2>
                <p>Ice Machines For Your Restaurant</p>
              <div class="entry">
            <p><a href="../restaurant-articles/ice-machines-for-your-restaurant.php" class="more">Read more</a></p>
              </div>
            </div>
            <div class="post">
                <h2 class="title">Recipe</h2>
                <p>Corny Raw Delight</p>
              <div class="entry">
            <p><a href="http://www.foo-bar.com/recipes/corny-raw-delight.php" class="more">Read more</a></p>
              </div>
            </div>
            <div class="post">
                <h2 class="title">Business Plan</h2>
                <p>Caribbean Restaurant</p>
              <div class="entry">
            <p><a href="http://www.businessplanning-4-you.com/business-plans/Caribbean-Restaurant-Business-Plan.html" class="more">Read more</a></p>
              </div>
            </div>
            </div>
        <!-- end recent-posts -->
    </div>
    <!-- end content -->
    <!-- start sidebar -->
    <div id="sidebar">
        <ul>
            <li>
                <ul>
                    <li><a href="http://www.foo-bar.com/Alabama/index.php">Alabama</a></li>
                    <li><a href="http://www.foo-bar.com/Alaska/index.php">Alaska</a></li>
                    <li><a href="http://www.foo-bar.com/Arizona/index.php">Arizona</a></li>
                    <li><a href="http://www.foo-bar.com/Arkansas/index.php">Arkansas</a></li>
                    <li><a href="http://www.foo-bar.com/California/index.php">California</a></li>
                    <li><a href="http://www.foo-bar.com/Colorado/index.php">Colorado</a></li>
                    <li><a href="http://www.foo-bar.com/Connecticut/index.php">Connecticut</a></li>
                    <li><a href="http://www.foo-bar.com/Delaware/index.php">Delaware</a></li>
                    <li><a href="http://www.foo-bar.com/Florida/index.php">Florida</a></li>
                    <li><a href="http://www.foo-bar.com/Georgia/index.php">Georgia</a></li>
                    <li><a href="http://www.foo-bar.com/Hawaii/index.php">Hawaii</a></li>
                    <li><a href="http://www.foo-bar.com/Idaho/index.php">Idaho</a></li>
                    <li><a href="http://www.foo-bar.com/Illinois/index.php">Illinois</a></li>
                </ul>
            </li>
            <li>
          <ul>
                    
                    <li><a href="http://www.foo-bar.com/Indiana/index.php">Indiana</a></li>
                    <li><a href="http://www.foo-bar.com/Iowa/index.php">Iowa</a></li>
                    <li><a href="http://www.foo-bar.com/Kansas/index.php">Kansas</a></li>
                    <li><a href="http://www.foo-bar.com/Kentucky/index.php">Kentucky</a></li>
                    <li><a href="http://www.foo-bar.com/Louisiana/index.php">Louisiana</a></li>
                    <li><a href="http://www.foo-bar.com/Maine/index.php">Maine</a></li>
                    <li><a href="http://www.foo-bar.com/Maryland/index.php">Maryland</a></li>
                    <li><a href="http://www.foo-bar.com/Massachusetts/index.php">Massachusetts</a></li>
                    <li><a href="http://www.foo-bar.com/Michigan/index.php">Michigan</a></li>
                    <li><a href="http://www.foo-bar.com/Minnesota/index.php">Minnesota</a></li>
                    <li><a href="http://www.foo-bar.com/Mississippi/index.php">Mississippi</a></li>
                    <li><a href="http://www.foo-bar.com/Missouri/index.php">Missouri</a></li>
                    <li><a href="http://www.foo-bar.com/Montana/index.php">Montana</a></li>
              </ul>
            </li>
      <li>
                
                <ul>
                    
                    <li><a href="http://www.foo-bar.com/Nebraska/index.php">Nebraska</a></li>
                    <li><a href="http://www.foo-bar.com/Nevada/index.php">Nevada</a></li>
                    <li><a href="http://www.foo-bar.com/New-Hampshire/index.php">New Hampshire</a></li>
                    <li><a href="http://www.foo-bar.com/New-Jersey/index.php">New Jersey</a></li>
                    <li><a href="http://www.foo-bar.com/New-Mexico/index.php">New Mexico</a></li>
                    <li><a href="http://www.foo-bar.com/New-York/index.php">New York</a></li>
                    <li><a href="http://www.foo-bar.com/North-Carolina/index.php">North Carolina</a></li>
                    <li><a href="http://www.foo-bar.com/North-Dakota/index.php">North Dakota</a></li>
                    <li><a href="http://www.foo-bar.com/Ohio/index.php">Ohio</a></li>
                    <li><a href="http://www.foo-bar.com/Oklahoma/index.php">Oklahoma</a></li>
                    <li><a href="http://www.foo-bar.com/Oregon/index.php">Oregon</a></li>
                    <li><a href="http://www.foo-bar.com/Pennsylvania/index.php">Pennsylvania</a></li>
                </ul>
          </li>
            <li>
              <ul>
                    
                    <li><a href="http://www.foo-bar.com/Rhode-Island/index.php">Rhode Island</a></li>
                    <li><a href="http://www.foo-bar.com/South-Carolina/index.php">South Carolina</a></li>
                    <li><a href="http://www.foo-bar.com/South-Dakota/index.php">South Dakota</a></li>
                    <li><a href="http://www.foo-bar.com/Tennessee/index.php">Tennessee</a></li>
                    <li><a href="http://www.foo-bar.com/Texas/index.php">Texas</a></li>
                    <li><a href="http://www.foo-bar.com/Utah/index.php">Utah</a></li>
                    <li><a href="http://www.foo-bar.com/Vermont/index.php">Vermont</a></li>
                    <li><a href="http://www.foo-bar.com/Virginia/index.php">Virginia</a></li>
                    <li><a href="http://www.foo-bar.com/Washington/index.php">Washington</a></li>
                    <li><a href="http://www.foo-bar.com/West-Virginia/index.php">West Virginia</a></li>
                    <li><a href="http://www.foo-bar.com/Wisconsin/index.php">Wisconsin</a></li>
                    <li><a href="http://www.foo-bar.com/Wyoming/index.php">Wyoming</a></li>
              </ul>
          </li>
        </ul>
          </li>
        </ul>
      <div style="clear: both;">&nbsp;</div>
    </div>
  <!-- end sidebar -->
</div>
<!-- end page -->
<div id="footer">
    <p id="legal">&copy;2008 All Restaurants USA. All Rights Reserved.</p>
  <p id="links"><a href="http://www.foo-bar.com/index.php">Home</a>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; <a href="http://www.foo-bar.com/terms.php">Terms</a> &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; <a href="http://www.foo-bar.com/faq.php">FAQ</a> &nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.foo-bar.com/contact.php">Contact Us</a></p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
 

Re: Parse error: syntax error, unexpected T_ELSE in

Posted: Thu Feb 26, 2009 8:46 am
by johnworf
okay i've gone through my code again and found curly braces not quite right IMHO (which probably isn't a great opinion) but i still get the same error.!!!

Code: Select all

 
<?php
// technocurve arc 3 php bv block1/3 start
$color1 = "#99cc33";
$color2 = "#ccff99";
$color = $color1;
// technocurve arc 3 php bv block1/3 end
?><?php require_once('../Connections/myconn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
mysql_select_db($database_myconn, $myconn);
$query_Recordset1 = "SELECT Restaurant, Website, `Description`, URL FROM Alabama WHERE URL = 'http://www.foo-bar.com/Alabama/alabaster.php' ORDER BY Restaurant ASC";
$Recordset1 = mysql_query($query_Recordset1, $myconn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Alabaster Restaurants</title>
<meta name="keywords" content="Alabaster Restaurants" />
<meta name="description" content="Find a restaurant inAlabaster;the US state of Alabama Why not add your restaurant to the list?" />
<link href="../style/usa.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- start header -->
<div id="header">
    <div id="logo">
      <h1><a href="#">foo-bar.com</a></h1>
  </div>
<div id="menu">
        <ul>
            <li><a href="http://www.foo-bar.com/index.html">Home</a></li>
            <li><a href="http://www.foo-bar.com/restaurant-articles/index.php">Restaurant Articles</a></li>
            <li><a href="http://www.foo-bar.com/recipes/index.php">Recipes</a></li>
        </ul>
    </div>
</div>
<div id="headerbg" align="center"><span style="white-space: nowrap" margin-top: "20px"><img src="../state-images/alabama.jpg" alt="state of alabama"><img src="../recipes/images/main-meals.jpg" width="450" height="209" /></span></div>
<div id="page">
    <!-- start content -->
    <div id="content">
        <!-- start latest-post -->
        <div id="latest-post" class="post">
            <h1 class="title">Alabaster Restaurants</h1>
<div class="entry">
<?php 
if ( $totalRows_Recordset1 > 0 ) 
                                {
                                echo '<table width="580" border="0" cellspacing="0" cellpadding="0"><tr><td><h2>Restaurant</h2></td><td><h2>Description</h2></td><td><h2>Report</h2></td></tr>';?>
 
                                <?php do {  ?>
                                <tr <?php 
                                echo " style=\"background-color:$color\"";
                                ?>>
                                <td><a href="http://<?php echo $row_Recordset1['Website']; ?>" target="_blank" rel="nofollow"><?php echo $row_Recordset1['Restaurant']; ?></a></td>
                                <td><?php echo $row_Recordset1['Description']; ?></td>
                                <td><a href="mailto:reportabuse@foo-bar.com?subject=<?php echo $row_Recordset1['URL']; ?>">Report Abuse</a></td>        
                                </tr>
                                    <?php 
                                    if ($color == $color1) {
                                    $color = $color2;
                                    } 
                                    else {
                                    $color = $color1;
                                    }
                                    ?>
                                <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1))  ?>
<?php echo '</table>'; ?>
<?php echo '<p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Alabaster?</p>;'; ?>
 
                            <?php } ?>
 
<?php else {
echo '<p>Do you want to <a href="../advertise-your-restaurant.php">advertise your restaurant</a> in the town of Alabaster?</p>'; 
        }?>
  </div>
      </div>
    <!-- end latest-post -->
        <!-- start recent-posts -->
        <div id="recent-posts">
            <div class="post">
                <h2 class="title">Restaurant Articles</h2>
                <p>Buying A Restaurant</p>
              <div class="entry">
            <p><a href="../restaurant-articles/buying-a-restaurant.php" class="more">Read more</a></p>
              </div>
            </div>
            <div class="post">
                <h2 class="title">Recipe</h2>
                <p>Cajun Chicken Wings</p>
              <div class="entry">
            <p><a href="http://www.foo-bar.com/recipes/cajun-chicken-wings.php" class="more">Read more</a></p>
              </div>
            </div>
            <div class="post">
                <h2 class="title">Business Plan</h2>
                <p>Seafood Restaurant</p>
              <div class="entry">
            <p><a href="http://www.businessplanning-4-you.com/business-plans/Seafood-Restaurant-Business-Plan.html" class="more">Read more</a></p>
              </div>
            </div>
            </div>
        <!-- end recent-posts -->
    </div>
    <!-- end content -->
    <!-- start sidebar -->
    <div id="sidebar">
        <ul>
            <li>
                <ul>
                    <li><a href="http://www.foo-bar.com/Alabama/index.php">Alabama</a></li>
                    <li><a href="http://www.foo-bar.com/Alaska/index.php">Alaska</a></li>
                    <li><a href="http://www.foo-bar.com/Arizona/index.php">Arizona</a></li>
                    <li><a href="http://www.foo-bar.com/Arkansas/index.php">Arkansas</a></li>
                    <li><a href="http://www.foo-bar.com/California/index.php">California</a></li>
                    <li><a href="http://www.foo-bar.com/Colorado/index.php">Colorado</a></li>
                    <li><a href="http://www.foo-bar.com/Connecticut/index.php">Connecticut</a></li>
                    <li><a href="http://www.foo-bar.com/Delaware/index.php">Delaware</a></li>
                    <li><a href="http://www.foo-bar.com/Florida/index.php">Florida</a></li>
                    <li><a href="http://www.foo-bar.com/Georgia/index.php">Georgia</a></li>
                    <li><a href="http://www.foo-bar.com/Hawaii/index.php">Hawaii</a></li>
                    <li><a href="http://www.foo-bar.com/Idaho/index.php">Idaho</a></li>
                    <li><a href="http://www.foo-bar.com/Illinois/index.php">Illinois</a></li>
                </ul>
            </li>
            <li>
          <ul>
                    
                    <li><a href="http://www.foo-bar.com/Indiana/index.php">Indiana</a></li>
                    <li><a href="http://www.foo-bar.com/Iowa/index.php">Iowa</a></li>
                    <li><a href="http://www.foo-bar.com/Kansas/index.php">Kansas</a></li>
                    <li><a href="http://www.foo-bar.com/Kentucky/index.php">Kentucky</a></li>
                    <li><a href="http://www.foo-bar.com/Louisiana/index.php">Louisiana</a></li>
                    <li><a href="http://www.foo-bar.com/Maine/index.php">Maine</a></li>
                    <li><a href="http://www.foo-bar.com/Maryland/index.php">Maryland</a></li>
                    <li><a href="http://www.foo-bar.com/Massachusetts/index.php">Massachusetts</a></li>
                    <li><a href="http://www.foo-bar.com/Michigan/index.php">Michigan</a></li>
                    <li><a href="http://www.foo-bar.com/Minnesota/index.php">Minnesota</a></li>
                    <li><a href="http://www.foo-bar.com/Mississippi/index.php">Mississippi</a></li>
                    <li><a href="http://www.foo-bar.com/Missouri/index.php">Missouri</a></li>
                    <li><a href="http://www.foo-bar.com/Montana/index.php">Montana</a></li>
              </ul>
            </li>
      <li>
                
                <ul>
                    
                    <li><a href="http://www.foo-bar.com/Nebraska/index.php">Nebraska</a></li>
                    <li><a href="http://www.foo-bar.com/Nevada/index.php">Nevada</a></li>
                    <li><a href="http://www.foo-bar.com/New-Hampshire/index.php">New Hampshire</a></li>
                    <li><a href="http://www.foo-bar.com/New-Jersey/index.php">New Jersey</a></li>
                    <li><a href="http://www.foo-bar.com/New-Mexico/index.php">New Mexico</a></li>
                    <li><a href="http://www.foo-bar.com/New-York/index.php">New York</a></li>
                    <li><a href="http://www.foo-bar.com/North-Carolina/index.php">North Carolina</a></li>
                    <li><a href="http://www.foo-bar.com/North-Dakota/index.php">North Dakota</a></li>
                    <li><a href="http://www.foo-bar.com/Ohio/index.php">Ohio</a></li>
                    <li><a href="http://www.foo-bar.com/Oklahoma/index.php">Oklahoma</a></li>
                    <li><a href="http://www.foo-bar.com/Oregon/index.php">Oregon</a></li>
                    <li><a href="http://www.foo-bar.com/Pennsylvania/index.php">Pennsylvania</a></li>
                </ul>
          </li>
            <li>
              <ul>
                    
                    <li><a href="http://www.foo-bar.com/Rhode-Island/index.php">Rhode Island</a></li>
                    <li><a href="http://www.foo-bar.com/South-Carolina/index.php">South Carolina</a></li>
                    <li><a href="http://www.foo-bar.com/South-Dakota/index.php">South Dakota</a></li>
                    <li><a href="http://www.foo-bar.com/Tennessee/index.php">Tennessee</a></li>
                    <li><a href="http://www.foo-bar.com/Texas/index.php">Texas</a></li>
                    <li><a href="http://www.foo-bar.com/Utah/index.php">Utah</a></li>
                    <li><a href="http://www.foo-bar.com/Vermont/index.php">Vermont</a></li>
                    <li><a href="http://www.foo-bar.com/Virginia/index.php">Virginia</a></li>
                    <li><a href="http://www.foo-bar.com/Washington/index.php">Washington</a></li>
                    <li><a href="http://www.foo-bar.com/West-Virginia/index.php">West Virginia</a></li>
                    <li><a href="http://www.foo-bar.com/Wisconsin/index.php">Wisconsin</a></li>
                    <li><a href="http://www.foo-bar.com/Wyoming/index.php">Wyoming</a></li>
              </ul>
          </li>
        </ul>
          </li>
        </ul>
      <div style="clear: both;">&nbsp;</div>
    </div>
  <!-- end sidebar -->
</div>
<!-- end page -->
<div id="footer">
    <p id="legal">&copy;2008 All Restaurants USA. All Rights Reserved.</p>
  <p id="links"><a href="http://www.foo-bar.com/index.php">Home</a>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; <a href="http://www.foo-bar.com/terms.php">Terms</a> &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; <a href="http://www.foo-bar.com/faq.php">FAQ</a> &nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://www.foo-bar.com/contact.php">Contact Us</a></p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>