PHP Code Error Causes a Blank Page
Posted: Fri Apr 10, 2009 6:42 am
I am new to PHP and MySQL, I'm trying to create a page that displays a SELECT statement inside of a table. When I run the page, it goes blank. I've reviewed the code and looked at examples online. I'm not sure what I am missing. I'm confident that the error is the php code displaying the data in the table. Can anyone guide me as to the problem?
-------------CODE-------------------------
<html>
<!-- Header -->
<? include("../include/header.php"); ?>
<!-- Menu -->
<? include('../include/menu.php'); ?>
<div id='main'>
<!-- Begin Content -->
<?php
<!-- Database Connection -->
require('../include/connect.php');
$result = mysql_query('
SELECT
category.name,
item.short_desc,
item.part_no,
item.vendor,
item.unit_price,
item.long_desc,
item.max_qty
FROM
item, category
WHERE
item.deleted = 1 AND item.category_id = category.id
ORDER BY
item.id DESC');
}
echo '<table border="1">
<tr>
<th>Category</th>
<th>Short Description</th>
<th>Part No</th>
<th>Vendor</th>
<th>Unit Price</th>
<th>Description</th>
<th>Max Qty</th>
<th></th>
<th></th>
<th></th>
</tr>';
while($row = mysql_fetch_assoc($result))
{
echo '<tr bgcolor=$bgcolor>';
echo '<td>' . $row['category.name'] . "</td>";
echo '<td>' . $row['item.short_desc'] . "</td>";
echo '<td>' . $row['item.part_no'] . "</td>";
echo '<td>' . $row['item.vendor'] . "</td>";
echo '<td>' . $row['item.unit_price'] . "</td>";
echo '<td>' . $row['item.long_desc'] . "</td>";
echo '<td>' . $row['item.max_qty'] . '</td>';
echo '<td> <a href="">Update</a> </td>';
echo '<td> <a href="">Delete</a> </td>';
echo '<td> <a href="">Order</a></td>';
echo '<tr>';
}
echo '</table>';
?>
<!-- End Content -->
<!-- Footer -->
<? include('../footer.php'); ?><html>
<!-- Header -->
<? include("../include/header.php"); ?>
<!-- Menu -->
<? include('../include/menu.php'); ?>
<div id='main'>
<!-- Begin Content -->
<?php
<!-- Database Connection -->
require('../include/connect.php');
$result = mysql_query('
SELECT
category.name,
item.short_desc,
item.part_no,
item.vendor,
item.unit_price,
item.long_desc,
item.max_qty
FROM
item, category
WHERE
item.deleted = 1 AND item.category_id = category.id
ORDER BY
item.id DESC');
}
echo '<table border="1">
<tr>
<th>Category</th>
<th>Short Description</th>
<th>Part No</th>
<th>Vendor</th>
<th>Unit Price</th>
<th>Description</th>
<th>Max Qty</th>
<th></th>
<th></th>
<th></th>
</tr>';
while($row = mysql_fetch_assoc($result))
{
echo '<tr bgcolor=$bgcolor>';
echo '<td>' . $row['category.name'] . "</td>";
echo '<td>' . $row['item.short_desc'] . "</td>";
echo '<td>' . $row['item.part_no'] . "</td>";
echo '<td>' . $row['item.vendor'] . "</td>";
echo '<td>' . $row['item.unit_price'] . "</td>";
echo '<td>' . $row['item.long_desc'] . "</td>";
echo '<td>' . $row['item.max_qty'] . '</td>';
echo '<td> <a href="">Update</a> </td>';
echo '<td> <a href="">Delete</a> </td>';
echo '<td> <a href="">Order</a></td>';
echo '<tr>';
}
echo '</table>';
?>
<!-- End Content -->
<!-- Footer -->
<? include('../footer.php'); ?>
-------------CODE-------------------------
<html>
<!-- Header -->
<? include("../include/header.php"); ?>
<!-- Menu -->
<? include('../include/menu.php'); ?>
<div id='main'>
<!-- Begin Content -->
<?php
<!-- Database Connection -->
require('../include/connect.php');
$result = mysql_query('
SELECT
category.name,
item.short_desc,
item.part_no,
item.vendor,
item.unit_price,
item.long_desc,
item.max_qty
FROM
item, category
WHERE
item.deleted = 1 AND item.category_id = category.id
ORDER BY
item.id DESC');
}
echo '<table border="1">
<tr>
<th>Category</th>
<th>Short Description</th>
<th>Part No</th>
<th>Vendor</th>
<th>Unit Price</th>
<th>Description</th>
<th>Max Qty</th>
<th></th>
<th></th>
<th></th>
</tr>';
while($row = mysql_fetch_assoc($result))
{
echo '<tr bgcolor=$bgcolor>';
echo '<td>' . $row['category.name'] . "</td>";
echo '<td>' . $row['item.short_desc'] . "</td>";
echo '<td>' . $row['item.part_no'] . "</td>";
echo '<td>' . $row['item.vendor'] . "</td>";
echo '<td>' . $row['item.unit_price'] . "</td>";
echo '<td>' . $row['item.long_desc'] . "</td>";
echo '<td>' . $row['item.max_qty'] . '</td>';
echo '<td> <a href="">Update</a> </td>';
echo '<td> <a href="">Delete</a> </td>';
echo '<td> <a href="">Order</a></td>';
echo '<tr>';
}
echo '</table>';
?>
<!-- End Content -->
<!-- Footer -->
<? include('../footer.php'); ?><html>
<!-- Header -->
<? include("../include/header.php"); ?>
<!-- Menu -->
<? include('../include/menu.php'); ?>
<div id='main'>
<!-- Begin Content -->
<?php
<!-- Database Connection -->
require('../include/connect.php');
$result = mysql_query('
SELECT
category.name,
item.short_desc,
item.part_no,
item.vendor,
item.unit_price,
item.long_desc,
item.max_qty
FROM
item, category
WHERE
item.deleted = 1 AND item.category_id = category.id
ORDER BY
item.id DESC');
}
echo '<table border="1">
<tr>
<th>Category</th>
<th>Short Description</th>
<th>Part No</th>
<th>Vendor</th>
<th>Unit Price</th>
<th>Description</th>
<th>Max Qty</th>
<th></th>
<th></th>
<th></th>
</tr>';
while($row = mysql_fetch_assoc($result))
{
echo '<tr bgcolor=$bgcolor>';
echo '<td>' . $row['category.name'] . "</td>";
echo '<td>' . $row['item.short_desc'] . "</td>";
echo '<td>' . $row['item.part_no'] . "</td>";
echo '<td>' . $row['item.vendor'] . "</td>";
echo '<td>' . $row['item.unit_price'] . "</td>";
echo '<td>' . $row['item.long_desc'] . "</td>";
echo '<td>' . $row['item.max_qty'] . '</td>';
echo '<td> <a href="">Update</a> </td>';
echo '<td> <a href="">Delete</a> </td>';
echo '<td> <a href="">Order</a></td>';
echo '<tr>';
}
echo '</table>';
?>
<!-- End Content -->
<!-- Footer -->
<? include('../footer.php'); ?>