Arithmatic
I have a form that posts records to a table. Now I have some 100 rows. Two fields (columns) are "DECIMAL". I want these two decimal records in the rows to be divided or multiplied and show up in a third column, (in each and every row). here is the code that I have;
$result = mysql_query("SELECT * FROM PURCHASE order by purchdate DESC,itemtype4,itemsupp4,itemdesc4 ASC");
echo "<table border='1'>
<tr>
<th>PURCHASE ID</th>
<th>PURCHASE DATE</th>
<th>AMOUNT</th>
<th>ITEM TYPE</th>
<th>SUPPLIER NAME</th>
<th>ITEM DESCRIPTION</th>
<th>ITEM QTY</th>
<th>UNIT RATE</th>
<th>PURCHASE NOTES</th>
<th>EDIT</th>
<th>DELETE</th>
<th>COPY</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['purchdate'] . "</td>";
echo "<td>" . $row['purchpkr'] . "</td>";
echo "<td>" . $row['itemtype4'] . "</td>";
echo "<td>" . $row['itemsupp4'] . "</td>";
echo "<td>" . $row['itemdesc4'] . "</td>";
echo "<td>" . $row['itemqty'] . "</td>";
echo "<td>" . $row['unitrate'] . "</td>";
echo "<td>" . $row['purchnotes'] . "</td>";
echo '<td><a href="purchedit.php?id=' . $row['id'] . '">Edit</a></td>';
echo '<td><a href="purchdel.php?id=' . $row['id'] . '">Delete</a></td>';
echo '<td><a href="purchcopy.php?id=' . $row['id'] . '">Copy</a></td>';
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
Unit rate is the column where i want the answer of 'purchpkr' divided by 'itemqty'
Subject
Written By
Posted
Arithmatic
April 08, 2011 03:49PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.