Jump to content

Session check is not working


SirChick

Recommended Posts

I have a session which bounce's out the user if the session doesn't contain their UserID.

I aint even changed the code in any way the only substantial change i have done is copy n pasted the script to a different pc and now it won't work at this pc. But it still does on the other computer even though they are 100% the same.

 

This is the session check:

$GetUserID = mysql_query("SELECT * FROM userregistration
                    WHERE UserID='{$_SESSION['Current_User']}'");

                  
// Fetch the row from the database
if (!($row = mysql_fetch_assoc($GetUserID))) {
    echo "User not found!";
    exit;
echo mysql_error();
}

 

The result gives:

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\include.php on line 41

User not found!

Link to comment
https://forums.phpfreaks.com/topic/72686-session-check-is-not-working/
Share on other sites

 

 

if (!isset($row = mysql_fetch_assoc($GetUserID))) {
    echo "User not found!";
    exit;
echo mysql_error();

 

=/ whats this do exactly ? never seen something like that before.

 

 

 

if the row isnt set it errors else it displays the userid

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.