Sveiki, meklēju palīdzību.
foreach ($_SESSION['items'] as $value){
$products = $db->query("SELECT * FROM products WHERE id IN('$value')");
while ($product = $products->fetch_object()) {
echo $product->name,' ',$product->price,'</br>';
}
}
foreach( $db->query("Select SUM(price) FROM products WHERE id IN ('$value')") as $row){
echo $row['SUM(price)'];
}
Iznākums
Kā lai panāku, ka SUM(price) summē dotos id($value) nevis parāda pēdējo?
Fukzzs miniblogs
- 0
Fukzzs 30.06.2017. 13:44
Ielogojies vai izveido profilu, lai komentētu!