Jump to content

Recommended Posts

I have placed a page together, and I am getting an error:

 

Parse error: syntax error, unexpected $end in /home/jedney/public_html/beta/index.php on line 284

 

Line 284 is the last line of code on my page, so I've spend the last hour or so double-checking my code, and still have come up with nothing.  I am not a PHP-guru, so I figured I would post my code, and maybe someone can see my mistake.  Thank you in advance.

 

<?php

// Page information will go here
if ($_GET['page'] == 'news')
{
if (isset($_GET['id']) ) 
{
$query="SELECT * FROM news WHERE id = '{$_GET['id']}'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  	<tr>
    	<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
      	<tr>
        	<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
          	<tr>
            	<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
              	<tr>
                	<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
                  <table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
               	<tr>
      	<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
   	<tr>
      	<td bgcolor=\"#FFFFFF\"><div align=\"left\"><strong><span class=\"style1\"><p><strong><span class=\"style1\">".$row['heading']."</span></strong></p>
<p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." -</strong> ".$row['extcontent']." <br />
</p>
<hr /></span></strong><span class=\"style1\"></span></div></TD></TR></TBODY></TABLE>
            	</TD>
           	</TR></TBODY></TABLE>
               	<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>");
}else	{
	$query="SELECT * FROM news";
	$result = mysql_query($query) or die(mysql_error());
	while($row = mysql_fetch_array($result))
	echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  		<tr>
    		<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
      		<tr>
       		 <td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
          		<tr>
            		<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
              		<tr>
                		<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
                  	<table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
                      	<tr>
                        	<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
                            	<tr>
                              	<td bgcolor=\"#FFFFFF\"><a href='index2.php?page=news&id=".$row['id']."'><strong><span class=\"style1\">".$row['date']." - ".$row['heading']."</span></strong></a></span></strong><span class=\"style1\"></span></div></TD></TR></TBODY></TABLE>
                              	</TD>
                         	 </TR></TBODY></TABLE>
                        	<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>"); 


} if ($_GET['page'] == 'company') 
{
$query="SELECT * FROM company";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
<tr>
<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
<table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
<tr>
<td bgcolor=\"#FFFFFF\"><span class=\"style1\">".$row['overview']."<br />
</span></div><br></TD></TR></TBODY></TABLE>
</TD>
</TR></TBODY></TABLE>
<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
	");
} else {
  echo("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#003366\">");
  echo("<tr>");
  echo("<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td><table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
  echo("<tr>");
  echo("<td width=\"67%\" align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />");
  echo("<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo("<tr>");
  echo("<td bgcolor=\"#FFFFFF\"><div align=\"center\">");
  
  // This is the date information for the greeting
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM homegreet";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("<span class=\"style1\"><strong>".$row['heading']."<br />
  </strong><span class=\"style1\">".$row['content']."<br />
  </span></div>");
  
  echo("</td>");
  echo("</tr>");
  echo("</table></td>");
  echo("</tr>");
  echo("</table>");
  echo("<br />");
  echo("<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo("<tr>");
  echo("<td bgcolor=\"#FFFFFF\">");
  echo("<strong><span class=\"style1\">Our Featured Client<br />");
  echo("</span></strong>");
  
  // This is the date information for the Featured Client
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM featureclient";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("<span class=\"style1\"><a href=".$row['url']." target=\"_blank\">".$row['client']."</a><br />
  ".$row['desc']."</span></div>");
  
  echo ("</td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table>");
  echo ("<br /></td>");
  echo ("<td width=\"33%\" align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />");
  echo ("<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo ("<tr>");
  echo ("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo ("<tr>");
  echo ("<td bgcolor=\"#FFFFFF\"><div align=\"center\">");
  
  // This is the date information for the company news
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM news LIMIT 0,5";
  $result = mysql_query($query) or die(mysql_error());
  while($row = mysql_fetch_array($result)){
  echo ("<p><strong><span class=\"style1\">".$row['heading']."</span></strong></p>
  <p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." - ".$row['content']." <br />
  <a href='index.php?page=news&id=".$row['id']."'>Read on</a>.<br />
  </p>
  <hr />
  </div>"); }
  
  echo ("</td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table>");
  echo ("<div align=\"center\" class=\"style1\"><span class=\"style8\"><br />");
  echo ("</span></div>");
  echo ("<div align=\"center\" class=\"style1\">");
      }
  ?>
  <?
  echo ("<div align=\"center\" class=\"style1\">");
  // FOOTER
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM footer";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("".$row['content']."<br><a href=".$row['agreeurl'].">".$row['agreetxt']."</a> - <a href=".$row['privacyurl'].">".$row['privacytxt']."</a><br><br>Tantrum Internet, ".$row['address']."<br>Phone ".$row['phone']." - Fax ".$row['fax']."");
  echo ("</div>");
  echo ("</body>");
  echo ("</html>");
  {
  ?>

 

I am assuming from the error, I have a bracket out of place, but I cannot be sure.  I guess what I'm looking for is the error for one, and possible for someone to give me some adivce as to how the coding looks, and if I could do anything different with it to save time/lines/server load.

 

 

Link to comment
https://forums.phpfreaks.com/topic/53472-solved-my-parse-error-problem/
Share on other sites

yes, It's missing a curly bracket...

 

find it by your self, it's not that hard...

 

Just and advice: Your code is a little messy...

 

Go identing your code, you will find it at a glance.

 

 

the last bracket is wrong and also it looks like is missing one closing bracket in the beginning.

try this

<?php

// Page information will go here
if ($_GET['page'] == 'news')
{
if (isset($_GET['id']) ) 
{
$query="SELECT * FROM news WHERE id = '{$_GET['id']}'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  	<tr>
    	<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
      	<tr>
        	<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
          	<tr>
            	<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
              	<tr>
                	<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
                  <table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
               	<tr>
      	<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
   	<tr>
      	<td bgcolor=\"#FFFFFF\"><div align=\"left\"><strong><span class=\"style1\"><p><strong><span class=\"style1\">".$row['heading']."</span></strong></p>
<p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." -</strong> ".$row['extcontent']." <br />
</p>
<hr /></span></strong><span class=\"style1\"></span></div></TD></TR></TBODY></TABLE>
            	</TD>
           	</TR></TBODY></TABLE>
               	<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>");
}else	{
	$query="SELECT * FROM news";
	$result = mysql_query($query) or die(mysql_error());
	while($row = mysql_fetch_array($result))
	echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  		<tr>
    		<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
      		<tr>
       		 <td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
          		<tr>
            		<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
              		<tr>
                		<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
                  	<table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
                      	<tr>
                        	<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
                            	<tr>
                              	<td bgcolor=\"#FFFFFF\"><a href='index2.php?page=news&id=".$row['id']."'><strong><span class=\"style1\">".$row['date']." - ".$row['heading']."</span></strong></a></span></strong><span class=\"style1\"></span></div></TD></TR></TBODY></TABLE>
                              	</TD>
                         	 </TR></TBODY></TABLE>
                        	<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>"); 


} if ($_GET['page'] == 'company') 
{
$query="SELECT * FROM company";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
<tr>
<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
<table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
<tr>
<td bgcolor=\"#FFFFFF\"><span class=\"style1\">".$row['overview']."<br />
</span></div><br></TD></TR></TBODY></TABLE>
</TD>
</TR></TBODY></TABLE>
<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
	");
} else {
  echo("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#003366\">");
  echo("<tr>");
  echo("<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td><table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
  echo("<tr>");
  echo("<td width=\"67%\" align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />");
  echo("<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo("<tr>");
  echo("<td bgcolor=\"#FFFFFF\"><div align=\"center\">");
  
  // This is the date information for the greeting
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM homegreet";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("<span class=\"style1\"><strong>".$row['heading']."<br />
  </strong><span class=\"style1\">".$row['content']."<br />
  </span></div>");
  
  echo("</td>");
  echo("</tr>");
  echo("</table></td>");
  echo("</tr>");
  echo("</table>");
  echo("<br />");
  echo("<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo("<tr>");
  echo("<td bgcolor=\"#FFFFFF\">");
  echo("<strong><span class=\"style1\">Our Featured Client<br />");
  echo("</span></strong>");
  
  // This is the date information for the Featured Client
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM featureclient";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("<span class=\"style1\"><a href=".$row['url']." target=\"_blank\">".$row['client']."</a><br />
  ".$row['desc']."</span></div>");
  
  echo ("</td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table>");
  echo ("<br /></td>");
  echo ("<td width=\"33%\" align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />");
  echo ("<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo ("<tr>");
  echo ("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo ("<tr>");
  echo ("<td bgcolor=\"#FFFFFF\"><div align=\"center\">");
  
  // This is the date information for the company news
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM news LIMIT 0,5";
  $result = mysql_query($query) or die(mysql_error());
  while($row = mysql_fetch_array($result)){
  echo ("<p><strong><span class=\"style1\">".$row['heading']."</span></strong></p>
  <p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." - ".$row['content']." <br />
  <a href='index.php?page=news&id=".$row['id']."'>Read on</a>.<br />
  </p>
  <hr />
  </div>"); }
  
  echo ("</td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table>");
  echo ("<div align=\"center\" class=\"style1\"><span class=\"style8\"><br />");
  echo ("</span></div>");
  echo ("<div align=\"center\" class=\"style1\">");
      }
  ?>
  <?
  echo ("<div align=\"center\" class=\"style1\">");
  // FOOTER
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM footer";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("".$row['content']."<br><a href=".$row['agreeurl'].">".$row['agreetxt']."</a> - <a href=".$row['privacyurl'].">".$row['privacytxt']."</a><br><br>Tantrum Internet, ".$row['address']."<br>Phone ".$row['phone']." - Fax ".$row['fax']."");
  echo ("</div>");
  echo ("</body>");
  echo ("</html>");
  }
  ?>

thegod:

 

Thanks.  That works and will show, but after that last }else{, isn't that supposed to show if the page is simply index.php?  It doesn't show, but it shows up with the other stuff, which I don't understand.  I think I may recode the whole thing.

try this

<?php

// Page information will go here
if ($_GET['page'] == 'news')
{
if (isset($_GET['id']) ) 
{
$query="SELECT * FROM news WHERE id = '{$_GET['id']}'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  	<tr>
    	<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
      	<tr>
        	<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
          	<tr>
            	<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
              	<tr>
                	<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
                  <table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
               	<tr>
      	<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
   	<tr>
      	<td bgcolor=\"#FFFFFF\"><div align=\"left\"><strong><span class=\"style1\"><p><strong><span class=\"style1\">".$row['heading']."</span></strong></p>
<p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." -</strong> ".$row['extcontent']." <br />
</p>
<hr /></span></strong><span class=\"style1\"></span></div></TD></TR></TBODY></TABLE>
            	</TD>
           	</TR></TBODY></TABLE>
               	<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>");
}else	{
	$query="SELECT * FROM news";
	$result = mysql_query($query) or die(mysql_error());
	while($row = mysql_fetch_array($result))
	echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  		<tr>
    		<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
      		<tr>
       		 <td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
          		<tr>
            		<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
              		<tr>
                		<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
                  	<table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
                      	<tr>
                        	<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
                            	<tr>
                              	<td bgcolor=\"#FFFFFF\"><a href='index2.php?page=news&id=".$row['id']."'><strong><span class=\"style1\">".$row['date']." - ".$row['heading']."</span></strong></a></span></strong><span class=\"style1\"></span></div></TD></TR></TBODY></TABLE>
                              	</TD>
                         	 </TR></TBODY></TABLE>
                        	<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>"); 

}
}

if ($_GET['page'] == 'company') 
{
$query="SELECT * FROM company";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo ("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td bgcolor=\"003366\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">
<tr>
<td bgcolor=\"#F1F1F1\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />
<table width=\"775\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">
<tr>
<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\" align=\"center\">
<tr>
<td bgcolor=\"#FFFFFF\"><span class=\"style1\">".$row['overview']."<br />
</span></div><br></TD></TR></TBODY></TABLE>
</TD>
</TR></TBODY></TABLE>
<br></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
	");
} else {
  echo("<table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#003366\">");
  echo("<tr>");
  echo("<td><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td><table width=\"800\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">");
  echo("<tr>");
  echo("<td width=\"67%\" align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />");
  echo("<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo("<tr>");
  echo("<td bgcolor=\"#FFFFFF\"><div align=\"center\">");
  
  // This is the date information for the greeting
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM homegreet";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("<span class=\"style1\"><strong>".$row['heading']."<br />
  </strong><span class=\"style1\">".$row['content']."<br />
  </span></div>");
  
  echo("</td>");
  echo("</tr>");
  echo("</table></td>");
  echo("</tr>");
  echo("</table>");
  echo("<br />");
  echo("<table width=\"400\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo("<tr>");
  echo("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo("<tr>");
  echo("<td bgcolor=\"#FFFFFF\">");
  echo("<strong><span class=\"style1\">Our Featured Client<br />");
  echo("</span></strong>");
  
  // This is the date information for the Featured Client
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM featureclient";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("<span class=\"style1\"><a href=".$row['url']." target=\"_blank\">".$row['client']."</a><br />
  ".$row['desc']."</span></div>");
  
  echo ("</td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table>");
  echo ("<br /></td>");
  echo ("<td width=\"33%\" align=\"center\" valign=\"top\" bgcolor=\"#F1F1F1\"><br />");
  echo ("<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
  echo ("<tr>");
  echo ("<td bgcolor=\"#003366\"><table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"3\">");
  echo ("<tr>");
  echo ("<td bgcolor=\"#FFFFFF\"><div align=\"center\">");
  
  // This is the date information for the company news
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM news LIMIT 0,5";
  $result = mysql_query($query) or die(mysql_error());
  while($row = mysql_fetch_array($result)){
  echo ("<p><strong><span class=\"style1\">".$row['heading']."</span></strong></p>
  <p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." - ".$row['content']." <br />
  <a href='index.php?page=news&id=".$row['id']."'>Read on</a>.<br />
  </p>
  <hr />
  </div>"); }
  
  echo ("</td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table></td>");
  echo ("</tr>");
  echo ("</table>");
  echo ("<div align=\"center\" class=\"style1\"><span class=\"style8\"><br />");
  echo ("</span></div>");
  echo ("<div align=\"center\" class=\"style1\">");
      }


  echo ("<div align=\"center\" class=\"style1\">");
  // FOOTER
  mysql_connect($Host,$User,$Pass);
  @mysql_select_db($DB) or die ("Unable to select requested database.");
  $query="SELECT * FROM footer";
  $result = mysql_query($query) or die(mysql_error());
  $row = mysql_fetch_array($result) or die(mysql_error());
  echo ("".$row['content']."<br><a href=".$row['agreeurl'].">".$row['agreetxt']."</a> - <a href=".$row['privacyurl'].">".$row['privacytxt']."</a><br><br>Tantrum Internet, ".$row['address']."<br>Phone ".$row['phone']." - Fax ".$row['fax']."");
  echo ("</div>");
  echo ("</body>");
  echo ("</html>");

  ?>

MadTechie:

 

That worked, thank you.  But, the only problem now, is the main page is showing up on all the pages I go to.

 

Line 184 is } else { and I thought, that would signal the site to understand, that I only want to show it if none of the variables are present.  Instead, that code after it is present in all the instances.  How is that possible?

Just a quick suggestion for SelfObscurity.

 

If you have a large amount of html that needs echoing, close the php tag and just write out the html like you'd do then open the tag again once the html is done.

Example, it's not a large amount of text, but it's still shows the point:

<?php  {
   while ($row = mysql_fetch_array($result))
    {
     $author = $row['author'];
     $title  = $row['title'];
     $date   = $row['date'];
     $data   = $row['data'];
?>
<h2><?=$title; ?></h2>
<blockquote><?=$date; ?>, by <b><?=$author; ?></b><br />
<?=$data; ?></blockquote>
<?php  }
  }
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.