I am trying to create a plant reference guide where the customer can grab plant description from one table (findplantsdb) and the availability from another table (plantsdb). I am new to PHP and I think I am close, but what is happening is that the plant description is coming up, but ALL of the plant availability for ALL the plants is coming up too. I need a particular plant that the customer selects from a form to show its description from table-findplantsdb and its availabililty from table-plantsdb.
NOTE: 'pullname' is the plant nsme that the customer selects.
Can anyone help me?
// Query
$query= "SELECT * FROM findplantsdb WHERE Name='" . $_GET['pullname'] . "'";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "<h4> ", $row['Name'], " ", $row['Patent'], "</h4> ",$row['Common'], "<p> Height: ", $row['Hname'], "<br> Spread: ", $row['Sname'], "<br> Color: ", $row['Color'], "<br> Light: ", $row['Light'], "<br> Zone: ", $row['Zone'], "<p> <img src=",$row['Picname'], " /> <p><p>", $row['Notes'], "<p><p> <hr width='50%' size='1' color='#A3A3A3'><p>";
}
$data= mysql_query("SELECT plantsdb.name, plantsdb.type, size, yard, heelin, nheel, field, total FROM plantsdb LEFT JOIN findplantsdb ON plantsdb.name=findplantsdb.Name") or die(mysql_error()); Print "<table border=0 cellspacing=2 cellpadding=0>";
Print "<font size=8 face='Arial'>";
while($info = mysql_fetch_array( $data )) { Print "<tr>"; Print "<td>".$info['name'] . "</td> "; Print "<th>- Size:</th> <td>".$info['size'] . "</td> "; Print "<th> - Type:</th> <td>".$info['type'] . "</td> "; Print "<th> - Yd:</th> <td>".$info['yard'] . "</td> "; Print "<th> - Heel:</th> <td>".$info['heelin'] . "</td> "; Print "<th> - NH:</th> <td>".$info['nheel'] . "</td> "; Print "<th> - Fld:</th> <td>".$info['field'] . "</td> "; Print "<th> - Total:</th> <td>".$info['total'] . " </td></tr>"; } Print "</table>";
?>