如何将两行mysql php相乘

时间:2013-01-28 13:50:55

标签: php

此代码显示如何将两行相乘的简单结果

示例30天乘以400薪水。 那么我该怎么做才能帮我解决这个问题。

 <?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>";
    }

    }
    }

?>

1 个答案:

答案 0 :(得分:1)

 $salary = $runrows['salary'];

使用上面的代码执行您想要的操作,对其进行乘法,演绎,添加....是基本数学,请参阅=符号?只需放置$salary = $days * $runrows['salary'];