>          I am not an expert at PHP / MySQL.  To me it would sound like the
> one = is assigning the $VerifyPasword[ContactID] whatever is in
> $_SESSION['ContactID'] which would mean that the else part would never be
> executed.  Honestly though, there is a lot that I don't know.  I know very

I can't really agree with that (Although, you are more than likely right....
It just sounds fishy for me that you can set two variables to the same value
inside a if statement, when a if statement is in fact there to rather
compare information - sort of, like a read-only state for the variables?)...
I'll keep my code here, and add / remove some debugging, and just let you
and the other's see what is actually going on here in regards to what
information the variables is actually caring and comparing...

Just to clarify myself above...
if ($var1 = $var2) { .....

In my crazy head, I see $var1 and $var2 to be in a sort of "read-only" state
inside the () of the if statement.  For a if statement to be able to change
the values in that instance, would be wrong for me.  Afterall, the logic of
a if statement does go something in the lines of "if value equals value then
execute this, else, execute that" etc etc etc.... There's nothing in that
logic of setting or changing any values.... ?

Back to the matter at hand tho...

        while ($VerifyPassword = mysql_fetch_array($PasswordCheckSQL)) {

echo "Session: " . $_SESSION['ContactID'] . ", DataBase: " .
$VerifyPassword[ContactID];
// In the browser, they are both returned as 1
//  Both the session and contact IDs are looked up from the same database,
through two
// different functions, they are the number from a auto_increment columb in
a table. And yes
// there is only one row in the table currently, the original selection is
done via a WHERE
// claues, and because there is only one row, both the $_SESSION and
$VerifiyPassword
// should thus return the same row number (auto_increment) because there is
only one
// row in the table?

          // Compare UserIDs
          if ($VerifyPasword[ContactID] = $_SESSION['ContactID']) {
            $_SESSION['Authenticated'] = "True";
            $AuthenticationFailure = "False";
            // In this example, the if statement will exit here (which is
where it should exit)
          } else {
             $_SESSION['Authenticated'] = "False";
             $AuthenticationFailure = "True";
          }


// Now let's look at how I understand the if statement to be, and what
happens.  This is now,
// after I have confirmed above with the echo, that the two variables are in
fact the same...
if ($VerifyPassword[ContactID] == $_SESSION['ContactID']) {
  echo "they are the same";
} else {
  echo "if statement lied, and reported them as not being the same";
  // statement exists here.
}

if (($VerifyPassword[ContactID]) == ($_SESSION['ContactID'])) {
  echo "they are the same";
} else {
  echo "if statement lied, and reported them as not being the same";
  // statement exists here.
}

if (!($VerifyPassword[ContactID] == $_SESSION['ContactID'])) {
  echo "they are not the same";
  // statement exists here.
} else {
  echo "the same";
}

// Now, I force the data to not be the same...
$_SESSION['ContactID'] = "1000";
if ($VerifyPassword[ContactID] == $_SESSION['ContactID']) {
  echo "if statement lied, and reported them as being the same";
  // Statement exists here.
} else {
  echo "they are not the same";
}

What, on heavens name, is going on here :P  I'm not going to ditch PHP or
anything like that, I know that it definately is something that I am doing
wrong.  The problem is, I don't know what I'm doing wrong.  99.99% if all my
statements used in my PHP applications, uses == or === (if I know 100% that
I am comparing data of the same type).  This one specific one, refuses to
operate.... :-(  And it's starting to annoy me now very much to say the
least :-(

--
me




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to