我正在尝试使用一些数据来计算商品的销售额,以使用其 id 来识别每个销售,然后将其显示在屏幕上,从而从 SQL 数据库中获取总数。供进一步使用。
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = 'mysql';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if (! $conn ) {
die('Could not connect: ' . mysql_error());
}
$sql = "select item_num * price + tp AS total from buyers where
Ref_code = '" . $result16['ref_code'] . "' ";
mysql_select_db('sales');
$retval1 = mysql_query($sql, $conn);
if (!$retval1) {
die('Could not get data: ' . mysql_error());
}
$result15 = mysql_fetch_assoc($retval1);
?>
<?php echo $result15['total']; ?> '
我希望它在我将 id 传递给 Query 时显示每次销售的总额,但它不显示任何内容。
哆啦的时光机