Add field values from MySQL
Posted: Fri Oct 27, 2006 7:21 am
Hello
I have the code below
I have added a columb "Total (£)" and would like to include the result of "VALUEExworks" multiplied by "YEAR QTY" into this row.
How would I achieve this?
Thanks
Geoff
I have the code below
Code: Select all
include("conn.php");
$result = mysql_query("SELECT * FROM projects where status = 'O'") or die(mysql_error());
echo "<table Align ='center' border='1'>";
echo "<tr> <th>VSI Number</th> <th>Customer</th> <th>Engineer</th> <th>Value (£)</th> <th>Year Qty</th><th>Total (£)</th> <th>Comments</th> <th>Last update</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['VSI_NUMBER'];
echo "</td><td>";
echo $row['CUSTOMER'];
echo "</td><td>";
echo $row['ENGINEER'];
echo "</td><td>";
echo $row['VALUEExworks'];
echo "</td><td>";
echo $row['YEARQTY'];
echo "</td><td>";
echo $row['COMMENTS'];
echo "</td><td>";
echo $row['ACTIONDATE'];
echo "</td></tr>";
}
echo "</table>";
?>
</body>
</html>How would I achieve this?
Thanks
Geoff