我试图在我的变量会话篮子中得到一个和(它是一个多数组),我想对代表产品成本的元素求和。
Page where I add elements into the basket
<?php
session_start();
include('link.php');
if(!isset($_SESSION['basket'])){
$_SESSION['basket']=[];
}
// $id_permit=$_POST['id_fp'];
// $chos
我像这样使用Array_sum
<?php
$totalAmount = $db->prepare('SELECT
a.proId, a.userId,
b.id, b.pPrice
FROM purchaseshistory AS a
INNER JOIN products AS b ON(a.proId=b.id)
WHERE a.userId=?');
$totalAmount->bind_param('i', $cus['cId']);