Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $con = mysqli_connect('xx.xx.x.x', 'xx', 'xx', 'xx') or die();
- $items = explode(',', $_SESSION['item']);
- $all_items = "";
- foreach ($items as $item) {
- if ($all_items == "") {
- $all_items = "'" . $item . "'";
- } else {
- $all_items .= ",'" . $item . "'";
- }
- }
- $query5 = "select distinct store_id,rate,iso from products where iso in (" . $all_items . ")";
- $rslt5 = mysqli_query($con, $query5);
- while ($row5 = mysqli_fetch_assoc($rslt5)) {
- $all5[] = $row5;
- }
- asort($all5);
- $all6 = array_values($all5);
- $counts = count($all6); //echo 'count is '.$counts.'<br/>';
- $k = 0;
- for ($j = 0; $j < $counts;) {
- $one = $all6[$k]['store_id'];
- $one_count = 0;
- $one_sum = 0;
- for ($i = 0; $i < $counts; $i++) {
- if ($all6[$i]['store_id'] == $one) {
- $one_count++;
- $one_sum = $one_sum + $all6[$i]['rate'];
- }
- }
- $j = $j + $one_count;
- echo 'store id' . $all6[$k]['store_id'];
- $k = $counts - $one_count + 1;
- echo ' items=' . $one_count . " & sum=" . $one_sum . '<hr/>';
- }
- echo '<pre>';
- print_r($all6);
- echo '</pre>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement