I get:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in
as an error but I don't know why!
I have to do this exercise for school and so far so good but now I get this error and I have been stuck for a while.
I am quiet new to this whole thing so I hope my code isn't to bad. My code is:
mysql_connect ("localhost","root","usbw");
mysql_select_db("classicmodels");
function productLinesDropDown(){
$result = mysql_query("SELECT productLine , textDescription FROM `productlines`");
echo "<form method='post' action=dropdownlist.php><select name='productlijn'>";
while($data = mysql_fetch_assoc($result)){
echo "<option value'" . $data["productLine"] . "'>" . $data["productLine"] . "</option>";
}
echo "</select><input name=Submit type=submit value=Submit></form>";
}
if(isset($_POST['Submit'])){
$productlijn = $_POST['productlijn'];
toonProductsProductline($productlijn);
}
function toonProductsProductLine($productline) {
$gegevens = mysql_query("SELECT productName , productScale , productDescritpion , productLine FROM `product`");
echo "<table><tr><td>productName</td><td>productScale</td><td>productDescription</td></tr>";
while($data = mysql_fetch_assoc($gegevens)){
if($data["productLine"] == $productline){
echo "<tr>";
echo "<td>" . $data["productName"] . "</td>";
echo "<td>" . $data["productScale"] . "</td>";
echo "<td>" . $data["productDescription"] . "</td>";
echo "</tr>";
}
}
echo "</table>";
}
productLinesDropDown();