I want to display MySQL results like this in a PHP/HTML table. Maybe add mouse over info for each plant if thats easy later.
+-----------------------------------------------------------+ |category1 ¦ category2 ¦ category3 ¦ category4 ¦ category5 ¦ +-----------+-----------+-----------+-----------+-----------+ | plantName ¦ plantName ¦ plantName ¦ plantName ¦ plantName ¦ | plantName ¦ plantName ¦ plantName ¦ plantName ¦ plantName ¦ | plantName ¦ plantName ¦ ¦ ¦ ¦ | ¦ plantName ¦ ¦ ¦ ¦ | ¦ plantName ¦ ¦ ¦ ¦ +-----------+-----------+-----------+-----------+-----------+
First I select plants by elevation and rainfall values.
$sql = mysql_query("SELECT * FROM `plants_tb`
WHERE $elevate>= elevationLOW && $elevate<= elevationHI &&
$rainfall>= rainfallLOW && $rainfall<= rainfallHI ORDER BY commonNames ASC");
$plant = 'commonNames';
$elevationH = 'elevationHI';
$elevationL ='elevationLOW';
$rainfallL ='rainfallLOW';
$rainfallH ='rainfallHI';
$species ='species';
echo "<table border='1'><tr><th>Name</th><th>Category</th></tr>";
while($row = mysql_fetch_array($sql)){
echo "<tr><td>" . $row[$plant] . "</td><td>" . $row['heightHI'] . "</td></tr>";
}
echo "</table>";
Now I need to display them in columns by height categories. Maybe I should make a temporary table of the selected plants, then categorize them, then display them in columns? Here is my idea for categorizing. I know this between code is not correct but, it gets my point out.
$sql="SELECT tree_height FROM $Elevation_Rainfall_list;
WHERE tree_height
BETWEEN 1 AND 7 = $Category1
BETWEEN 7 AND 15 = $Category2
BETWEEN 15 AND 30 = $Category3
BETWEEN 30 AND 9999 = $Category4
if not = $Category5
mahalo for the support!