I would like to be able to multiply all the prices for example from my database then multiply the total by 10.
The code below do the addition not multiplication
<?php
$d = $_GET['d'];
$con = mysql_connect("localhost","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("databasename", $con);//
$sql= "SELECT SUM(prices) FROM tablename WHERE Date = '$d' AND Prices >0.20 AND Type= 'sold'";
$results = mysql_query($sql);
$row = mysql_fetch_array($results);
echo $row[0]*10;
mysql_close($con);
?>
example
id prices
1 25
2 36
3 45
That is i want 25*36*45*10 and not 25+36+45*10
Hope anyone can help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…