I am building a plant reference guide that pulls from two tables within a mysql db . One table "findplantsdb" has the plant name, desc, image and the other table "plantdb" has the availability of plants listed in the yard and field.
I need both databases to come together (JOIN) by matching the name of the plant in both databases and provide the information that the visitor checkboxes in two different categories: Rose Class and Flower Color
So far everything is working except the availability part (plantsdb).
Currently it only displays the availability if there is only one checkbox selected in the "Rose Class" and one in "Flower Color". If there are more selected in either checkbox category, it gives me the error "no results found".
I think this is a looping problem, but I do not know how to fix it. I need it to display the availability for ALL the plants selected by checkbox.
Can anyone assist with this? Thanks!!
(I will provide below only the php relating to the issue described above)
<?PHP
$data = "SELECT plantsdb.name, plantsdb.type, plantsdb.size, plantsdb.yard, plantsdb.field, plantsdb.total FROM plantsdb LEFT JOIN findplantsdb ON plantsdb.name=findplantsdb.Name WHERE findplantsdb.Color = $FlowerList AND findplantsdb.Lastword = $LastwordList AND findplantsdb.Type LIKE 'ROSE'";
$result = mysql_query ($data); //run the query.
Print "<table border=0 cellspacing=2 cellpadding=0 align='center'>";
Print "<font size=2 face='Arial'>";
$num_of_rows = mysql_num_rows($result);
if($num_of_rows > 0)
{
while($row = mysql_fetch_array($result)) {
Print "<tr>";
Print "<td>".$row['name'] . "</td>";
Print "<td>-Size: ".$row['size'] . "</td>";
Print "<td>-Type: ".$row['type'] . "</td>";
Print "<td>-Yd: ".$row['yard'] . "</td>";
Print "<td>-Fld: ".$row['field'] . "</td></tr>";
}
Print "</table>";
}
else
{
print "no results found";
}
?>