Re: Destroying Sessions

From: Date: Fri, 10 May 2002 03:47:25 +0000
Subject: Re: Destroying Sessions
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-96897@lists.php.net to get a copy of this message
On Friday 10 May 2002 10:52, Steve Buehler wrote: > No....keep writing to the list. Next time, you might actually Good idea. [snip] > >What baffles me, is > > > > while ($VerifyPassword = mysql_fetch_array($PasswordCheckSQL)) { > > // Compare UserIDs > > if ($VerifyPasword[ContactID] = $_SESSION['ContactID']) { > > $_SESSION['Authenticated'] = "True"; > > $AuthenticationFailure = "False"; > > } else { > > $_SESSION['Authenticated'] = "False"; > > $AuthenticationFailure = "True"; > > } > > > >Works ($VerifiyPassword[ContactID] comes out of a MySQL Lookup, > >$_SESSION['ContactID'] was previously, also looked up via a MySQL Query). > >However, from what I understand in the documentation, in this case, the if > >statement should be '==' in which case, it doesn't work ?!?!?!?!?!?!? > > This is exactly what I am talking about, and why it is so confusing. > > Everywhere, I use either a double =, or triple = in the if statements, > > with a ! to use the is "not" true... Only in this specific statement, > > the only way I can get it to work, was with a single =. Now what makes > > that if statement so special over the others, that this one requires a > > single = and not a double like all the other hundreds I have in my code? What is confusing you is that the single equal sign /seems/ to work and is masking the real error(s) in your code. if ($VerifyPasword[ContactID] = $_SESSION['ContactID']) This statement is /always/ true if $_SESSION['ContactID'] is non-zero, or non-empty. If your code is copy-and-paste then the error is most likely because you used a single 's' in $VerifyPasword[ContactID]. And also is better to single-quote your array indices (see manual on arrays for reason): $VerifyPassword['ContactID'] -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* QOTD: "A child of 5 could understand this! Fetch me a child of 5." */

« previous php.general (#96897) next »