Hello - super green here again. I am creating a web page for work (also my school project) and the php code is working fine on its own... when I add it to the html code, it shows up on the web page as code instead of building the chart like it does by itself. I have been working on this for days, trying all kinds of different configurations, but nothing has worked so far. A good portion of th code is below. Any insights on how I screwed this up would be great!
Thank You,
Ann
Code:
<style type="text/css">
BODY {
background-image: url("picts/background-sidebar.gif");
background-repeat: repeat-y;
background-position: 0px left;
}
</style>
<link rel="StyleSheet" href="corporatestyle.css" type="text/css">
<script language="JavaScript" type="text/javascript" src="javascripts.js"></script>
<script language="JavaScript" type="text/javascript" src="pop-closeup.js"></script>
<script language="JavaScript" type="text/javascript" src="mouseover.js"></script>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" marginheight="0" marginwidth="0">
<!-- START PAGE TABLE-->
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td ALIGN="LEFT" VALIGN="TOP">
<script language="JavaScript" type="text/javascript" src="header.js"></script>
<!-- START PICTURE TABLE -->
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#FFFFFF" class="printhide">
<tr>
<td background="picts/Montage.jpg"><a href="index.html">
<IMG SRC="picts/spacer.gif" border="0" width="700" height="80"></a><br>
</td>
</tr>
</table>
<!-- END PICTURE TABLE -->
<img src="picts/stretchbar.jpg" width="100%" height="28"><br>
<script language="JavaScript" type="text/javascript" src="menu.js"></script>
<!-- START CORNER TABLE -->
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%" background="picts/shadow1.gif" class="printhide">
<tr>
<td width="227">
<IMG SRC="picts/corner.gif" height="40" width="227"><br>
</td>
<td>
<IMG SRC="picts/spacer.gif" height="40" width="10" border="0"><br>
</td>
</tr>
</table>
<!-- END CORNER TABLE -->
<!-- START OUTER TABLE-->
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td ALIGN="left" VALIGN="top">
<!-- START SPLIT TABLE-->
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td ALIGN="LEFT" VALIGN="TOP" width="15">
<script language="JavaScript" type="text/javascript" src="pageheight.js"></script>
</td>
<td ALIGN="LEFT" VALIGN="TOP" width="150">
<!-- START SIDEBAR AREA -->
<script language="JavaScript" type="text/javascript" src="sidebar.js"></script>
<br>
<IMG SRC="picts/spacer.gif" height="5" width="150" border="0"><br>
</td>
<td ALIGN="LEFT" VALIGN="TOP" width="30">
<IMG SRC="picts/spacer.gif" height="400" width="30" border="0"><br>
</td>
<td ALIGN="CENTER" VALIGN="TOP">
<!-- END SIDEBAR AREA -->
<!-- START CONTENT TABLE -->
<TABLE cellpadding="0" cellspacing="0" border="0" width="1000">
<tr>
<td ALIGN="LEFT" VALIGN="TOP">
<tr>
<td><span class="title">Test Data ...</span>
<p class="copy">
<span class="subhead">Structural and Thermal Test Data</span>
<br />
Acadia products are tested to the highest quality ratings in the industry for residential and multi-family housing.
</p>
<br />
</td>
<TABLE cellpadding="0" cellspacing="0" border="0" width="80%">
<tr>
<td>
<!-- START CHART -->
<?php
$conn = @new mysqli('localhost', 'root', 'bonkers1', 'prodtestdata');
if (mysqli_connect_errno() != 0)
{
$errno = mysqli_connect_errno();
$errmsg = mysqli_connect_error();
echo "Connect Failed with: ($errno) $errmsg<br/>\n";
exit;
}
$conn->query("SET NAMES 'utf8'");
// prepare the query
$query_str = "SELECT * FROM products";
$result = @conn->query($query_str);
if ($result === FALSE)
{
$errno = $conn->errno;
$errmsg = $conn->error;
echo "Connect Failed with: ($errno) $errmsg<br/>\n";
$conn->close();
exit;
}
else
{
echo <<<EOM
<table border="5" bordercolor="darkblue" bordercolorlight="#b2b2ff" cellspacing="0" cellpadding="4">
<thead>
<tr>
<th>Product Name</td>
<th>Size</td>
<th>Structural</td>
<th>Air</td>
<th>Water</td>
<th>U-Factor</td>
<th>SHGC</td>
<th>VT</td>
<th>Structural Report</th>
<th>Thermal Report</th>
</tr>
</thead>
EOM;
// get the data
while (($row_data = @$result->fetch_assoc()) !==NULL)
{
echo <<<EOM
<tr>
<td>{$row_data['prod_name']}</td>
<td align="center">{$row_data['prod_size']}</td>
<td align="center">{$row_data['aama_rate']}</td>
<td align="center">{$row_data['air_rate']}</td>
<td align="center">{$row_data['water_rate']}</td>
<td align="center">{$row_data['u_rate']}</td>
<td align="center">{$row_data['shgc_rate']}</td>
<td align="center">{$row_data['vt_rate']}</td>
</tr>
EOM;
}
echo <<<EOTABLE
</table>
EOTABLE;
//
// clean up results
//
$result->close();
}
//
// clean up connection
//
$conn->close();
?>
<!-- END CHART -->
</td>
</tr>
</TABLE>
<!-- END CONTENT TABLE -->
</td>
</tr>
</table>
<!-- END SPLIT TABLE -->
</td>
</tr>
</table>
<!-- END OUTER TABLE-->
</td>
</tr>
</table>
<!-- END PAGE TABLE-->
</td>
</tr>
<tr>
<td VALIGN="BOTTOM">
<script language="JavaScript" type="text/javascript" src="menu.js"></script>
<img src="picts/stretchbar.jpg" width="100%" height="28"><br>
<!-- START COPYRIGHT -->
<TABLE cellpadding="0" cellspacing="0" border="0" width="100%" background="picts/bottom-shade.gif"><tr><td width="10">
<IMG SRC="picts/spacer.gif" height="45" width="10" border="0" alt="image"><br>
</td><td ALIGN="left" VALIGN="middle">
<script language="JavaScript" type="text/javascript" src="copyright.js"></script>
</td><td ALIGN="right" VALIGN="middle">
</TD><td width="10">
<IMG SRC="picts/spacer.gif" height="10" width="10" border="0" alt="image"><br>
</td></tr></table>
<!-- END COPYRIGHT -->
</td>
</tr>
</table>
</BODY>
</HTML>
Ann
Comment