I get this error message:
mysql_numrows(): supplied argument is not a valid MySQL result resource
when running the following code:
<form name="price" action="4.php">
<?php
mysql_connect ("localhost", "user", "");
mysql_select_db ("db");
?>
You selected
<b><?php
print ($year);
?></b> as your year.
<p>
You selected
<b><?php
print ($make);
?></b> as your make.
<p>
<?php
//Model
$query = "
SELECT prices.model, prices.make
FROM prices
WHERE prices.make=$make
ORDER BY prices.make";
$result = mysql_query($query);
$num = mysql_numrows($result);
// use 'single quotes' unless you need php to evaluate a $var within the string
echo "<font face=\"Arial\" color=\"red\">Model:</font><br>";
echo '<select name="model">';
echo '<option value="" selected>Select Model</option>';
/Dynamically generate drop-down list/
while ($row=mysql_fetch_array($result)) {
$data = $row['model'];
echo "<option value='$data'>$data</option>";
}
echo '</select><p>';
echo "<INPUT type = 'hidden' name = 'year' value = '";
echo $year . "'>";
echo "<INPUT type = 'hidden' name = 'make' value = '";
echo $make . "'>";
?>
<input type="submit">
</form>
best I can figure is it has something do do with the fields I am filtering in the query or just a totally stupid coding error. Hope someone can help.