user1833487
user1833487

Reputation: 145

how to multiply two rows mysql php

This code show simple result how to multiply two rows

Example 30 days multiply by 400 salary. So how can I do this please help me to fix this issue.

 <?php
    while ($runrows = mysql_fetch_assoc($run))
    {

     //get data
    $workerid = $runrows['workerid'];
    $keywords = $runrows['workername'];
    $salary = $runrows['salary'];
    $days = $runrows['days'];

    echo "<table  class='hovertable' width='100%'>";

    echo "<tr width='50%' onmouseover=\"this.style.backgroundColor='#999999';\" onmouseout=\"this.style.backgroundColor='#d4e3e5';\"><td width='20%'><a href=\"workerdetail.php?id=$id\" class=\"style1\">$workerid</a></td>
    <td width='20%'>$workername</td>
    <td width='20%'>$salary</td>
    <td width='20%'>$days</td>

    echo "</table>";
    }

    }
    }

?>

Upvotes: 0

Views: 942

Answers (1)

samayo
samayo

Reputation: 16495

 $salary = $runrows['salary'];

Do what you want with the code above, multiply, deduct, add... to it. Is a basic maths, see the = sign? just place $salary = $days * $runrows['salary'];

Upvotes: 1

Related Questions