I am trying to display a percentage of a result on my webpage. I have managed to get the result numers of: 50.0 and 90.0 But do not know the code to add to the query to take off 20% so I can also display the numbers:40.0 and 72.0 ?
I have managed to get this working on all pages except the results page of a search form,anyone any ideas ? This is my results page: $search = "%" . $_POST["search"] . "%"; $result = "SELECT **,***,** FROM members WHERE ** LIKE '$search'"; $result = mysql_query ($result); { while ($row = mysql_fetch_array ($result)) { echo $row[0] . "<b><br>"; echo $row[1] ."\$<b><br>" ; echo $row[2] ."\$<b><br>" ; echo $row[3] ."<b><br><hr>" ; } } ?> PHP: I managed to get it working on all other pages like this: $query="SELECT BAAR,foo FROM `mydatabase`ORDER BY foo DESC LIMIT 5"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center></center></b><br><br>"; $i=0; while ($i < $num) { $domain=mysql_result($result,$i,"BAAR"); $cost=mysql_result($result,$i,"foo"); echo "<b>$domain<br>HOW MUCH($)$cost<hr><br>"; $p = "$cost"; $per = $p - ($p*.20); $L = "$cost"; $low = $L - ($L*.80); $i++; } ?> PHP: As you can see above the 20% and 80% is not stored on the database I just need to do the math from the $cost result. The problem I have is I am getting confused trying to play with the echo $row results in example one above. Do I need to query the echo $row[1] result ? ($row[1]) is $cost