This code is meant to fetch information inculding a picture but i get the following errors
Notice: Undefined variable: query in C:\Program Files\Apache Group\Apache2\htdocs\browse_products.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\browse_products.php on line 18
<?php
require_once ('./mysql_connect.php');
if (isset($_GET['aid'])) {
$query = "SELECT product_name, description, price FROM products WHERE products.make_id = make.make_id ";
} else {
echo 'oops billet, youve fuked up';
}
echo '<table border="0" width="90%" cellspacing="3" cellpadding="3" align="center">
<tr>
<td align="left" width="20%"><b>Product Name</b></td>
<td align="left" width="40%"><b>Description</b></td>
<td align="right" width="20%"><b>Price</b></td>
</tr>';
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
// Display each record.
echo " <tr>
<td align=\"left\"><a href=\"browse_products.php?aid={$row['product_id']}\">{$row['product_name']}</a></td>
<td align=\"left\">" . stripslashes($row['description']) . "</td>
<td align=\"right\">\${$row['price']}</td>
</tr>\n";
} // End of while loop.
echo '</table>';
mysql_close();
?>