I am currenlty working on a shopping cart. I have run into an issue where fetch_array is not pulling results from items in a mysql DB. I need this to pull a current quantity and the user notes on the item. It then adds the new value to the old value and combines the notes. Currently, only $newQty & $newNotes are returning a value which is from a form on the page before. Any ideas?
$item_query = "SELECT COUNT(*) FROM `rel` WHERE `cart_id` = ' " .$cartId. "' && `id_item` = ' " .$item_id. " '";
$item_result = $mysqli->query($item_query) or die($mysqli->error.__LINE__);
if($item_result->num_rows == 1) {
while($getOldItems = $item_result->fetch_array()){
$oldQty = $getOldItems['amount'];
$oldNotes = $getOldItems['notes'];
$newQty = ($oldQty + $item_quantity);
$newNotes = $oldNotes . $item_notes;
print("Old QTY: $oldQty, Old Notes: $oldNotes, New QTY: $newQty, New Notes: $newNotes");
}
}