Welcome Guest, Not a member yet? Register   Sign In
Weird logic error
#5

[eluser]diego.greyrobot[/eluser]
Hey thanks for the reply. Ok so i pasted in your code:
Code:
function update_cart($id = false, $quantity = 1, $checkout = false) {
        //if adding an item from the shop
        if ($id) {
            $cart = ($id && $quantity > 0) ? $this->add_to_cart($id, $quantity) : $this->delete_from_cart($id);
        }
         //if updating the cart from a cart form
        else { die(var_dump($id));
            $cart = $this->update_cart_post();
        }
//outputs: bool(false)
this is the main problem, that $id shows up as a bool within the else block but as numeric string in the upper if block. is there anyway i'm overwriting the $id value with something else? If i understand correctly these should be local function scope vars and that shouldnt be a problem right? why is the $id variable showing both values?


Messages In This Thread
Weird logic error - by El Forum - 03-07-2009, 12:54 PM
Weird logic error - by El Forum - 03-07-2009, 01:09 PM
Weird logic error - by El Forum - 03-07-2009, 01:18 PM
Weird logic error - by El Forum - 03-07-2009, 01:33 PM
Weird logic error - by El Forum - 03-07-2009, 06:29 PM
Weird logic error - by El Forum - 03-07-2009, 06:58 PM
Weird logic error - by El Forum - 03-07-2009, 07:46 PM
Weird logic error - by El Forum - 03-07-2009, 10:15 PM
Weird logic error - by El Forum - 03-07-2009, 10:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB