Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6831615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:45:29+00:00 2026-05-26T22:45:29+00:00

My page sets signin_time sets it to NOW() , sets logged_in to 1 when

  • 0

My page sets signin_time sets it to NOW(), sets logged_in to 1 when user successfully signs into page. What I want to do is to set signout_time to NOW() when user signs out too. For this purpose I’m using following query

$stmt = $db->prepare("UPDATE `ulog` SET `logged_in`=0, `signout_time`=NOW(),`ckey`= '', `ctime`= '' WHERE user_id=? AND logged_in=1") or die($db->error);

I tried to execute this query. It didn’t return any error message, but I haven’t noticed any change in db table too, also php error log doesn’t show anything.

Maybe I have syntax error (I’m setting logged_in=0 where logged_in=1). I have no other idea how to do that. Maybe I should search for rows where signout_time=0? Any suggestions?

Update

Here is whole function:

function logout() {
    global $db, $wsurl;
    if (isset($_SESSION['user_id'])) {
        $userid = $_SESSION['user_id'];
        $stmt = $db->prepare("UPDATE `ulog` SET `logged_in`=0, `signout_time`=NOW() WHERE user_id=? AND logged_in=1") or die($db->error);
    } else {
        $userid = $_COOKIE['user_id'];
        $stmt = $db->prepare("UPDATE `ulog` SET `logged_in`=0, `signout_time`=NOW(),`ckey`= '', `ctime`= '' WHERE user_id=? AND logged_in=1") or die($db->error);
    }

    $stmt->bind_param("i", $userid) or die($stmt->error);
    $stmt->execute() or die($stmt->error);
    $stmt->close();
    $_SESSION = array(); //destroy all of the session variables}
    session_destroy();
    foreach ($_COOKIE as $c_id => $c_value) {
        setcookie($c_id, '', 1, "/");
    }

    header("Location: " . $wsurl);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:45:30+00:00Added an answer on May 26, 2026 at 10:45 pm

    You have to execute the query.

    $userId = 1; // some number
    $stmt->execute(array($userId));
    

    Or you could combine them into one using method chaining:

     $db->prepare(
         "UPDATE `ulog` SET `logged_in`=0, `signout_time`=NOW(),
         `ckey`= '', `ctime`= '' WHERE user_id=? AND logged_in=1"
     )->execute(array($userId));
    

    Also, make sure your $userid is being set. Do a var_dump() on it and see what you get.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When the user sets the focus to an edit control on my HTML page,
I have a page in my windows phone 7 app. This page sets it's
I have a number of sets of input fields on page, like this: <div
I have a page that sets a cookie and then redirects the user to
I want to create a bookmarklet that sets the page to be editable, that
The routine below inserts a page, sets permalinks to postname then attempts to update
I am using jquery to create two sets of tabs on a page. The
page contents: aa<b>1;2'3</b>hh<b>aaa</b>.. .<b>bbb</b> blabla.. i want to get result: 1;2'3aaabbb match tag is
ColdFusion sets the CFID and CFTOKEN cookie on every single page, obviously connecting that
I have a page with several sets of radio buttons that are used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.