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

[eluser]diego.greyrobot[/eluser]
Thanks FuzzyOne. I checked everything and both the if and the else run one right after the other. It's really weird, i know $id is set to a number (i can even echo out the value in an exit statement) and the code in the if($id) block will run but also the else block will run. and if a put an exit statement in the else block and echo the value of $id it is (false).

What I did to work around the problem was place a check inside the $this->update_cart_post() method to only run if there's post data.

That's mainly where my problem was, i would get an error because $this->update_cart_post() was trying to process non existent post data, even if an $id was passed in.

So the question remains, why do both the if and the else blocks run even if $id has a value that is not 0 or false?

Thanks for your help so far. It reaffirms my questions about php.


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