I need to do a computation within my website. I have all parameters but couldn't figure out how to combine them to one result.
Please help me to solute this!
I get the data from mysql database: (shorted)
<?php
$res = mysql_query('SELECT SUM(status) FROM ' . 'success_rate', $con);
if ($row = mysql_fetch_array($res, MYSQL_NUM))
{
$rate = trim($row[0]); ?>
<?php
$res = mysql_query('SELECT Count(*) FROM ' . 'user_registration', $con);
?>
So i get 2 classic params
What I need is to have just one Number in the end. This is how the computation shall work:
((<?= $status ?> / <?= $2nd ?>)*100)-200 = result
Would appreciate your help.
There are a few problems. First, the
mysql
extension is depreciated. Usemysqli
instead. When you do that you changemysql_fetch_array($res, MYSQL_NUM)
tomysqli_fetch_array($res)
.Next, you need to close the
if
statement brackets. You only have an opening bracket.That second code snippet is a syntax errpr. Do this:
$result = (($status / $second)*100)-200
Beyond that, I don't know what else you want because you haven't given enough detail.