RE: Recalculation ?

From: Date: Sun, 20 Jan 2002 22:14:58 +0000
Subject: RE: Recalculation ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16011@lists.php.net to get a copy of this message
You shouldn't need to unset session variables if you're going to use them again, just write over them. And to check if a session variable has been used or not, you can use: if (session_is_registered($qty)){ calcluation in here } If the calculation part is the same in your 'if' statement, then you should need to do the session_unset() and session_register() stuff. If $qty is already registered as a session variable, you can safely run session_register($qty) again and cause no harm to the already registered variable, so this will register a session variable, but not change an existing session variable. Also, in logic (I haven't tested though), your condition for your 'if' statement ($qty == $qty) will always evaluate to true. Adam -----Original Message----- From: Dave Carrera [mailto:dave@davecarrera.com] Sent: Saturday, January 19, 2002 3:17 AM To: php List Subject: Recalculation ? Hi All, I have create a page to calculate qtys and show totals. This works fine, except that I change a qty the change is not registered and calculate from the old value. I am using sessions and have try a loop of if($qty == $qty){ than calc stuff here} else{ session_unset($qty); session_register($qty); calc stuff here } And have tried other ways but to no avail. Can someone throw any light on this. As always any help is appreciated. Dave C

« previous php.db (#16011) next »