Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.