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.


-----Original Message-----
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
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}
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

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to