Page 1 of 1

Parse error

Posted: Tue May 23, 2006 5:57 pm
by rjwelte
Parse error: syntax error, unexpected $end on line 451. I've checked my braces several times and can't identify what is causing this error. Please help!

john

Code: Select all

<?php
class CustomerOrder	
{
	// declare a class member variable 
	var $totalRows;
	var $page;
	// the constructor
	function CustomerOrder ()
	{
		$this->totalRows = '';
		$this->page = '';
	}
	
	function createContent($orderid)	
	{
		// get order Summary
		require_once("../Connections/Conn.php");
		mysql_select_db($database_Conn);//, $Conn
		$query  = "SELECT * FROM orders WHERE orderid = ".$orderid;
		$result = mysql_query($query) or die(mysql_error());
		$row = mysql_fetch_array($result, MYSQL_BOTH);
		$this->totalRows = mysql_num_rows($result);
		$custid = $row['custid'];
		$cardtype = $row['cardtype'];
		$cardnum = $row['cardnum'];
		$expdate = $row['expdate'];
		$cardname = $row['cardname'];
		$civ = $row['civ'];
		$orderstatus = $row['orderstatus'];
		$amount = $row['amount'];

		// get orderdetail
		$cartHeader = $row["cartHeader"];
		$cartItems = $row["cartItems"];
		$cartSummary = $row["cartSummary"];
		
		//expand order Details and format display
		$sql = "SELECT * FROM `customers` WHERE custid=".$row['custid'];
		$result1 = mysql_query($sql) or die("Could not query customer table.".mysql_error()); 
		$row1 = mysql_fetch_array($result1, MYSQL_BOTH);
		$fname = $row1['fname'];
		$lname = $row1['lname'];
		$address = $row1['address'];
		$city = $row1['city'];
		$state = $row1['state'];
		$Tozippostal = $row1['Tozippostal'];
		$country = $row1['country'];
		
		// Build customer info table
		$this->page .= <<<EOD
		<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
		<tr>
		  <th class="WADADataTableHeader">Order ID:</th>
		  <td class="WADADataTableCell">$orderid</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">Customer ID:</th>
		  <td class="WADADataTableCell">$custid</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">Card Type:</th>
		  <td class="WADADataTableCell">$cardtype</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">Card Number:</th>
		  <td class="WADADataTableCell">$cardnum</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">Expiation Date:</th>
		  <td class="WADADataTableCell">$expdate</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">Name on Card:</th>
		  <td class="WADADataTableCell">$cardname</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">CIV:</th>
		  <td class="WADADataTableCell">$civ</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">Amount:</th>
		  <td class="WADADataTableCell">$amount</td>
		</tr>
		<tr>
		  <th class="WADADataTableHeader">Order Status:</th>
		  <td class="WADADataTableCell">
		  <form action="orders_Update.php" method="post" enctype="multipart/form-data" target="_self"><input name="orderid" type="hidden" value="$orderid" /><input name="orderstatus" type="text" size="1" value="$orderstatus" />&nbsp;&nbsp;&nbsp;<input name="Update" type="submit" value="Update Status" /></form>
		  </td>
		</tr>
		</table>
		EOD;
		//build header
		$header = explode("|", $cartHeader);
		$numHeader = count($header);
		$body = "";
		$body .= "<table width='100%' border='1'><caption><b>Your Order</b></caption><tr>";
		for ($i=0;$i<$numHeader;$i++)
		{
			$body .=  "<td>".$header[$i]."</td>";
		}
		$body .=  "</tr>";
		$this->page .= $body;
		$body = "";

		// build cartItems
		$Itemsrows = explode("@", $cartItems);
		$numItemRows = count($Itemrows);
		if ($numItemRows > 0)
		{
			for ($i=0;$i<$numItemRows;$i++)
			{
				$Items = explode("|", $Itemsrows[$i]);
				$numItems = count($Items);
				$body .=  "<tr>";
				for ($j=0;$j<$numItems;$j++)
				{ 
					$body .=  "<td>".$Items[$j]."</td>";
				}
				$body .=  "</tr>";
			}
			$this->page .= $body;
			$body = "";
		}
		else
		{
			$Items = explode("|", $Itemsrows[0]);
			$numItems = count($Items);
			$body .=  "<tr>";
			for ($j=0;$j<$numItems;$j++)
			{ 
				$body .=  "<td>".$Items[$j]."</td>";
			}
			$body .=  "</tr>";
			$this->page .= $body;
			$body = "";

		}
	 
		// build summary
		$summary = explode("|",$cartSummary); 
		$numSummary = count($summary);
		$body .=  "<tr><td colspan='".$numHeader."'>".$summary[0]."</td></tr>";
		$num = $numHeader-1;
		for ($i=1;$i<$numSummary-1;$i++)
		{	
			$summaryRow = explode("#", $summary[$i]);
			$body .=  "<tr>";
			$body .=  "<td colspan='".$num."' align='right' >".$summaryRow[0]."</td>";
			$body .=  "<td align='right' >".$summaryRow[1]."</td>";
			$body .=  "</tr>";
		}
		$this->page .= $body;
		$body = "";
		$this->page .= <<<EOD
		<tr><td colspan="$numHeader">Shipping Information</td></tr>
		<tr>
		<td>order id</td>
		<td>first name</td>
		<td>last name</td>
		<td>address</td>
		<td>city</td>
		<td>state</td>
		<td>zip</td>
		<td>country</td>
		</tr>
		<tr>
		<td>$orderid</td>
		<td>$fname</td>
		<td>$lname</td>
		<td>$address</td>
		<td>$city</td>
		<td>$state</td>
		<td>$Tozippostal</td>
		<td>$country</td>
		</tr>
		</table>
		EOD;
		mysql_free_result($result);
		mysql_free_result($result1);
	}
	// Gets the content of the page
	function Get()	
	{
		$this->page .=  "|".$this->totalRows;
		return $this->page;
	}	
}
//End class
?>
<?php

$orderid = 90;
$page = new CustomerOrder();
// Create the order and shipping info Display
$page->createContent($orderid);				
$_content = $page->get();
$content = explode("|", $_content);
$totalRows = $content[1];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/siteassist_template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Order Details</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" type="text/css" href="../siteassist_css/style.css" />
<link rel="stylesheet" type="text/css" href="../siteassist_css/color.css" />
<link rel="stylesheet" type="text/css" href="../siteassist_css/template.css" />
<link rel="stylesheet" type="text/css" href="../siteassist_css/navigation.css" />
<link rel="stylesheet" type="text/css" href="../siteassist_css/navigation_color.css" />
<link rel="stylesheet" type="text/css" href="../siteassist_css/my_styles.css" />
<script type="text/JavaScript">
<!-- 
	function WA_SAW_topNavToggle(NavCount,IsOver) {
	  var navC = document.getElementById("SAW_TopNav_" + NavCount);
	  var tCHandle = navC.className.replace(/_Hover/i, "");
	  if (IsOver) {
		tCHandle += "_Hover";
	  }
	  navC.className = tCHandle;
	}
	//-->
</script>
<!-- InstanceBeginEditable name="head" -->
<link href="../WA_DataAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="../WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable --><!-- InstanceParam name="Body_onLoad" type="text" value="" -->
<script type="text/JavaScript">
<!-- 
	function WA_SAW_topNavToggle(NavCount,IsOver) {
	  var navC = document.getElementById("SAW_TopNav_" + NavCount);
	  var tCHandle = navC.className.replace(/_Hover/i, "");
	  if (IsOver) {
		tCHandle += "_Hover";
	  }
	  navC.className = tCHandle;
	}
	//-->
</script>
</head>
<body onload="">
<table width="760" border="0" cellspacing="0" cellpadding="0">
  <tr>
	  <td>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="header">
  <tr>
		<td width="18"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="18"/></td>
    <td class="headerLogo"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="logoTL"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" height="12"/></td>
        <td><img src="../siteassist_images/spacer.gif" alt="Spacer" height="12"/></td>
        <td class="logoTR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" height="12"/></td>
      </tr>
			<tr>
        <td class="logoL"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" /></td>
				<td><img src="../images/logo.jpg" alt="Nate's Bait Fishing Products" /></td>
        <td class="logoR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" /></td>
			</tr>
    </table></td>
    <td class="headerSite">		 <br />
          <!-- WASA_SiteDescription_Start -->
		  <img src="../images/logo_titlegif.gif" width="580" height="100" alt="" />
		  <!-- WASA_SiteDescription_End -->
	</td>
  </tr>
</table>

		<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr valign="top">
		    <td width="18"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="18" height="2"/></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="topNav">
          <tr>
            <td class="topNavT"><img src="../siteassist_images/spacer.gif" alt="Spacer" height="7"/></td>
            <td class="topNavTR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="7" height="7"/></td>
          </tr>
          <tr>
            <td class="topNavBody"><table cellspacing="0" cellpadding="0" border="0" class="SAW_TopNav_TableHeight">
              <tr>
                <td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td id="SAW_TopNav_1" class="SAW_TopNav_Light_Bevel"><a href="../index.php" onmouseout="WA_SAW_topNavToggle(1,false);" onmouseover="WA_SAW_topNavToggle(1,true);">Home&nbsp;Page</a></td>
                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td id="SAW_TopNav_2" class="SAW_TopNav_Light_Bevel"><a href="../aboutus.php" onmouseout="WA_SAW_topNavToggle(2,false);" onmouseover="WA_SAW_topNavToggle(2,true);">About&nbsp;Us</a></td>
                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td id="SAW_TopNav_3" class="SAW_TopNav_Light_Bevel"><a href="../storepoliccies.php" onmouseout="WA_SAW_topNavToggle(3,false);" onmouseover="WA_SAW_topNavToggle(3,true);">Store&nbsp;Policcies</a></td>
                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td id="SAW_TopNav_4" class="SAW_TopNav_Light_Bevel"><a href="../sitemap.php" onmouseout="WA_SAW_topNavToggle(4,false);" onmouseover="WA_SAW_topNavToggle(4,true);">Site&nbsp;Map</a></td>
                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td id="SAW_TopNav_5" class="SAW_TopNav_Light_Bevel"><a href="../contactus.php" onmouseout="WA_SAW_topNavToggle(5,false);" onmouseover="WA_SAW_topNavToggle(5,true);">Contact&nbsp;Us</a></td>
                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td id="SAW_TopNav_6" class="SAW_TopNav_Light_Bevel"><a href="../testimonials.php" onmouseout="WA_SAW_topNavToggle(6,false);" onmouseover="WA_SAW_topNavToggle(6,true);">Testimonials</a></td>
                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
                <td id="SAW_TopNav_7" class="SAW_TopNav_Light_Bevel"><a href="../productcategories.php" onmouseout="WA_SAW_topNavToggle(7,false);" onmouseover="WA_SAW_topNavToggle(7,true);">Product&nbsp;Categories</a></td>
                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
              </tr>
            </table></td>
            <td class="topNavR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="7"/></td>
          </tr>					
        </table></td>
        <td width="65"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="65" height="2"/></td>
      </tr>
    </table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="belowTopNav">
      <tr>
        <td class="belowTopNavT">&nbsp;</td>
        <td class="belowTopNavR">&nbsp;</td>
      </tr>
    </table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="subMainHeadline">&nbsp;</td>
        <td class="shadingR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="7"/></td>
      </tr>
    </table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="subLeftContent"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="subMainContent">
				<!-- InstanceBeginEditable name="SideNavigation" -->
				<table>
					<tr>
						<td class="SAW_TopNavBorderLeft"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
		                <td id="SAW_TopNav_8" class="SAW_TopNav_Light_Bevel"><a href="index.php" onmouseout="WA_SAW_topNavToggle(8,false);" onmouseover="WA_SAW_topNavToggle(8,true);">Admin&nbsp;</a></td>
		                <td class="SAW_TopNavBorderRight"><img alt="" src="../siteassist_images/spacer.gif" width="1" height="1" /></td>
	               </tr>
               </table>				
				<!-- InstanceEndEditable -->
			</td>
						<td class="subMainContentR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="11" height="1"/></td>
          </tr>
            <tr>
              <td class="subMainContentBL"><img src="../siteassist_images/spacer.gif" alt="Spacer" height="9"/></td>
              <td class="subMainContentBR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="11" height="9"/></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
					  <tr>
						  <td width="5" height="10"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="5" height="10"/></td>
						  <td height="10"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="5" height="10"/></td>						
			  </tr>
            <tr>
						  <td width="5" height="10"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="5" height="10"/></td>
              <td>
			  <!--
			  <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                <tr>
                  <td class="featuredTL"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="9" height="9"/></td>
                  <td class="featuredT"><img src="../siteassist_images/spacer.gif" alt="Spacer" height="9"/></td>
                  <td class="featuredTR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="9" height="9"/></td>
                </tr>
                <tr>
                  <td class="featuredL">&nbsp;</td>
                  <td class="featuredBody"><span class="featuredHeadline">Resources</span><br />
                      <br />
                    Lorem ipsum dolor sit amet.<br />
                    <a href="#" class="featured"> Learn More... </a><br />
                    <br />
                    Lorem ipsum dolor sit amet.<br />
                    <a href="#" class="featured"> Learn More... </a><br />
                    <br />
                    Lorem ipsum dolor sit amet.<br />
                    <a href="#" class="featured"> Learn More... </a><br />
                    <br />
                  </td>
                  <td class="featuredR">&nbsp;</td>
                </tr>
                <tr>
                  <td class="featuredBL"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="9" height="9"/></td>
                  <td class="featuredB"><img src="../siteassist_images/spacer.gif" alt="Spacer" height="9"/></td>
                  <td class="featuredBR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="9" height="9"/></td>
                </tr>
              </table>
			  -->
			  </td>
            </tr>
          </table>
          </td>
        <td id="rightContent"><table width="100%" border="0" cellspacing="0" cellpadding="0" >
          <tr>
            <td class="subBodyContentTL"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" height="12"/></td>
            <td class="subBodyContentT"><img src="../siteassist_images/spacer.gif" alt="Spacer" height="12"/></td>
            <td class="subBodyContentTR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" height="12"/></td>
          </tr>
          <tr>
            <td class="subBodyContentL"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" height="12"/></td>
            <td class="subBodyContentBody">
				<!-- InstanceBeginEditable name="PageBody" --> 
                <div class="WADADetailsContainer"> 
				<div class="WADAHeader">Details</div>
				<div class="WADAHorizLine"><img src="../WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div>
				
				<?php 
				if ($totalRows > 0) 
				{ // Show if recordset not empty 
				echo  $content[0];
				?>
                  <div class="WADAHorizLine"><img src="../WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div>
                  <div class="WADAButtonRow">
                    <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td class="WADADataNavButtonCell" nowrap="nowrap"><a href="orders_Results.php" target="_self"><img src="../WA_DataAssist/images/Pacifica/Refined_allOrders.gif" id="Results" name="Results" width="56" height="17" alt="Results" border="0" /></a></td>
                        <td class="WADADataNavButtonCell" nowrap="nowrap">&nbsp;</td>
                        <td class="WADADataNavButtonCell" nowrap="nowrap"><a href="orders_Results.php?orderstatus='p'" target="_self"><img src="../WA_DataAssist/images/Pacifica/Refined_pendingOrders.gif" id="Results" name="Results" width="91" height="17" alt="Results" border="0" /></a></td>
                      </tr>
                    </table>
                  </div>
				<?php 
				}
				// Show if recordset empty 
				else if ($totalRows == 0) 
				{ 
				?>
					<div class="WADANoResults">
					<div class="WADANoResultsMessage">No record found.</div>
					</div>
				<?php 
				} 
				?> 
					</div>
				<!-- InstanceEndEditable -->
			</td>
            <td class="subBodyContentR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="12" height="12"/></td>
          </tr>
        </table>
          <h1>&nbsp;</h1></td>
        <td class="shadingR"><img src="../siteassist_images/spacer.gif" alt="Spacer" width="7"/></td>
      </tr>
    </table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="shadingB">&nbsp;</td>
        <td class="shadingBR">&nbsp;</td>
      </tr>
    </table>
		<div id="footer">
			<!-- InstanceBeginEditable name="SiteFooter" -->
			<div class="siteFooterLinks"> <a href="../storepolicies.php">Store&nbsp;Policies</a> | <a href="../shoppingcart.php">Shopping&nbsp;cart</a> | <a href="../checkout.php">Checkout</a> </div>
		  <!-- InstanceEndEditable -->
		</div>	
	</td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
:?:

Posted: Tue May 23, 2006 6:07 pm
by RobertGonzalez
My editor said there was an error here:

Code: Select all

<?php $this->page .= <<<EOD ?>
But I suspect it has something to do with the closing heredoc identifier EOD being indented. Line 91, unindent the EOD; You may also want to have a look at what the manual says about heredoc syntax.

Heredoc

Posted: Tue May 23, 2006 6:24 pm
by rjwelte
It is very important to note that the line with the closing identifier contains no other characters, except possibly a semicolon (;).

It Works now Thanks

john

Posted: Tue May 23, 2006 9:51 pm
by RobertGonzalez
You caught that, huh? Good job.