Hi Claus
I'm still confused by these associative arrays, these are the two functions I use to extract the data into the 'Cart' and 'Catalog' arrays
What do I need to do to these to return associative arrays ?
Kind regards
I'm still confused by these associative arrays, these are the two functions I use to extract the data into the 'Cart' and 'Catalog' arrays
Code:
Function GetBasketItems() { //Used to get all the items in the customers basket require '../includes/cxwdb.inc.php'; session_start(); unset($_SESSION['CartItems']); $BasID = $_SESSION['custDetails']['CustomerID']; $sql = "call procGetAllItems($BasID)"; $result = mysqli_query($link, $sql); if (!$result) { $error = mysqli_errno($link) . ": " . mysqli_error($link) . "\n"; $error1 = $prodID; $error2 = $BasID; include '../err/error.html.php'; exit(); } if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) $cItems[] = array( 'Name' => $row['Name'], 'ProductID' => $row['ProductID'], 'Quantity' => $row['Quantity'], 'Price' => $row['Price'], 'LinePrice' => $row['LinePrice'], 'Location' => $row['Location'], 'Discount' => $row['Discount'], 'BasketID' => $row['BasketID'], 'countrytax' => $row['countrytax'], 'LineTax' => $row['LineTax']); $_SESSION['CartItems'] = $cItems; return true; } Else { return false; } } Function GetCatalogue($DeptID = 0) { unset($tempcat); //unset($_SESSION['Catalogue']); If ($DeptID > 0) { include '../includes/cxwdb.inc.php'; $result = mysqli_query($link, "call procGetCatalogue($DeptID)"); if (!$result) { $error = mysqli_errno($link) . ": " . mysqli_error($link) . "\n"; $error1 = $prodID; $error2 = $BasID; include '../err/error.html.php'; exit(); } if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) $tempcat[] = array( 'ProductID' => $row['ProductID'], 'Name' => $row['Name'], 'DepartmentID' => $row['DepartmentID'], 'Price' => $row['Price'], 'Location' => $row['Location'], 'DepartmentName' => $row['DepartmentName'], 'Discount' => $row['Discount'], 'InBasket' => $row['InBasket']); Return $tempcat; } } }
Kind regards
Comment