Hello. I've been working through chapter 4 and trying to work on my own revision of the page in the document. However, when I attempt to load it I get a blank page. Currently here is the page that I have written.
Code:
<?php
//connect to MySQL;
$link= mysql_connect("localhost", "xxxx", "xxxxx")
or die (mysql_error());
//make sure we're using the right database
mysql_select_db("prod_mgmt")
or die (mysql_error());
$query = "SELECT pl_id, pl_name " .
"FROM product_line";
$result = mysql_query($query)
or die(mysql_error());
$num_products = mysql_num_rows($result);
$product_header=<<<EOD
<h2><center>Product Database</center></h2>
<table width="70%" border="1" cellpadding="2" cellspacing="2" align="center">
<tr>
<th>PL ID</th>
<th>Product Line Name</th>
</tr>
</table>
EOD;
$product_details = '';
while ($row = mysql_fetch_array($result)) {
$pl_id = $row['pl_id'];
$pl_name = $row['pl_name'];
$product_details .=<<<EOD
<tr>
<td>$pl_id</td>
<td>$pl_name</td>
</tr>
EOD;
}
$product_details .=<<<EOD
<tr>
<td>$nbsp;</td>
</tr>
<tr>
<td>Total: $num_products Products</td>
</tr>
EOD;
$product_details .=<<<EOD
<tr>
<td> </td>
</tr>
<tr>
<td>Total :$num_products Products</td>
</tr>
EOD;
?>
I have edited the page multiple times and I believe the issue comes down to this section of the page.
Code:
$product_details = '';
while ($row = mysql_fetch_array($result)) {
$pl_id = $row['pl_id'];
$pl_name = $row['pl_name'];
$product_details .=<<<EOD
<tr>
<td>$pl_id</td>
<td>$pl_name</td>
</tr>
EOD;
}
$product_details .=<<<EOD
<tr>
<td>$nbsp;</td>
</tr>
<tr>
<td>Total: $num_products Products</td>
</tr>
EOD;
$product_details .=<<<EOD
<tr>
<td> </td>
</tr>
<tr>
<td>Total :$num_products Products</td>
</tr>
EOD;
?>
Any assistance on where the problem is would be greatly appreciated.