Hi All,
no, I made only the 1 change. Now I've changed it some. But get the following error.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/html/showproducts.php on line 12
<html>
<head>
<title>Jumbo Status-Show Products</title>
</head>
<body>
<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status", $db);
if (isset($REQUEST[maker_id])){
$maker_id = $REQUEST[maker_id];
$result = mysql_query("SELECT Products.product_name, Products.product_price, Products.product_model FROM Products INNER JOIN Makers ON Products.maker_id = Makers.maker_id WHERE Makers.maker_id = $maker_id");
$num = mysql_num_rows($result); /////Line 12
for ($i=0; $i < $num; $i++){
$myrow=mysql_fetch_array($result);
$product_name = mysql_result($result,$i,"product_name");
$product_price = mysql_result($result, $i, "product_price");
$product_model = mysql_result($result, $i, "product_model");
}
}
else {
if (isset($REQUEST[product_type_id])){
$product_type_id = $REQUEST[product_type_id];
$result = mysql_query("SELECT Products.product_name, Products.product_price, Products.product_model FROM Products INNER JOIN ProductTypes ON Products.product_type_id = ProductTypes.product_type_id WHERE ProductTypes.product_type_id = $product_type_id");
$num = mysql_num_rows($result);
for ($i=0; $i < $num; $i++){
$myrow=mysql_fetch_array($result);
$product_name = mysql_result($result,$i,"product_name");
$product_price = mysql_result($result, $i, "product_price");
$product_model = mysql_result($result, $i, "product_model");
}
}
}
?>
</body>
</html>
Tables:
Products:
product_id
product_name
product_price
product_model
product_type_id
maker_id
ProductTypes:
product_type_id
product_type_detail
Makers:
maker_id
maker_detail