Jump to content

Maths in php


MemphiS

Recommended Posts

Example:

 

<?php
$total_rows = mysql_num_rows(mysql_query("SELECT `id` FROM `users` WHERE `accepted` = '1'")); // 1 rows
$total = mysql_num_rows(mysql_query("SELECT `id` FROM `users`")); // 2 rows
$roundoff = round($total_rows / $total);

echo("$roundoff");

 

What i want this to get at is 50% as there is two "total" rows and only 1 accepted. Not to sure how i should code it. Thanks for any replys ;)

Link to comment
https://forums.phpfreaks.com/topic/55228-maths-in-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.