turpentyne
11-20-2011, 05:30 PM
I'm trying to show the search results scores as percentages, but I'm only getting '0%'
any thoughts?
I've got this:$max_score = 0;
if($row['score'] > $max_score){ $max_score = $row['score']; } //because we are ordering by score we can assume on the first run this wil be the max score.
while($row = mysql_fetch_array($data)){
echo '<tr>
<td align="left" valign=top width=85px > <a href="view_plant.php?id=' . $row['plant_name'] . '">View</a></td>
<td align="left" valign=top width=315px>'.@number_format(($row['score']/$max_score)*100,0).'% ' . $row['taxonomic_genus'] . ' '. $row['scientific_name'] . ' ' . $row['species_hybrid_marker'] . ' <font color=#999999>' . $row['genus_hybrid_marker'] . ' ' . $row['infraspecific_rank'] . ' ' . $row['infraspecific_epithet'] . '</font></td><td valign=top>' .$row['common_name_english'] . '</td>
</tr><tr><td colspan=3><img src="http://www.twigzy.com/images/line.gif" width=700 height=1></td></tr>';
}
echo '</table><br><br>'; }
any thoughts?
I've got this:$max_score = 0;
if($row['score'] > $max_score){ $max_score = $row['score']; } //because we are ordering by score we can assume on the first run this wil be the max score.
while($row = mysql_fetch_array($data)){
echo '<tr>
<td align="left" valign=top width=85px > <a href="view_plant.php?id=' . $row['plant_name'] . '">View</a></td>
<td align="left" valign=top width=315px>'.@number_format(($row['score']/$max_score)*100,0).'% ' . $row['taxonomic_genus'] . ' '. $row['scientific_name'] . ' ' . $row['species_hybrid_marker'] . ' <font color=#999999>' . $row['genus_hybrid_marker'] . ' ' . $row['infraspecific_rank'] . ' ' . $row['infraspecific_epithet'] . '</font></td><td valign=top>' .$row['common_name_english'] . '</td>
</tr><tr><td colspan=3><img src="http://www.twigzy.com/images/line.gif" width=700 height=1></td></tr>';
}
echo '</table><br><br>'; }