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

  • Home
  • SEARCH
  • 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 8076983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:22:46+00:00 2026-06-05T15:22:46+00:00

I want to update the lastlogin column value .i wrote the code like this

  • 0

I want to update the lastlogin column value .i wrote the code like this ,but column is nt updated .i wrote the some code in main.js for inserting query.here i didnt wrote any code for updating the lastlogin column value in main.js.
for updating the lastlogin column i wrote the updatelogin function in the dbfunc.php as below.

function updatelogin($lastlogin)
    {
         alert("hi");
        $query="UPDATE users set last_login='$lastlogin' where email='".$email."'";
         $queryresult= mysql_query($query);
         $count=mysql_num_rows($queryresult);
            if($count>0)
             {
                    return 1;
             }
            else
             {
                return 0;
            }    
        }   


    function register($details_arr)
       {
          $emailcheck=db_func::checkemail($details_arr['email']);
            if($emailcheck == 0){

         //print_r($details_arr);
         $regemail=$details_arr['email'];
       $regpwd=$details_arr['password'];
       $zip=$details_arr['zip'];
       $secqun=$details_arr['secqun'];
       $answer=$details_arr['answer'];
       $now=date("Y-m-d H:i:s",time());
       $lastlogin=date("Y-m-d H:i:s",time());


       $query= "INSERT INTO users (email,md5pwd,zip,squestion,sanswer,member_since,last_login,last_ip) VALUES('".$regemail."','".$regpwd."','".$zip."','".$secqun."','".$answer."','".$now."','".$lastlogin."','".$_SERVER['REMOTE_ADDR']."')";
                 $queryresult=mysql_query($query);
                 echo mysql_error();
                if($queryresult)
                {
                    non_db_func::loginuser($email);
                    db_func::updatelogin($details_arr['lastlogin']);
                    return 1;
                    }

                else
                    return 0;
                    }
                     else{

                     return 2;    
                      }

can any one tell me ,why lastlogin column isnt updated in my db

  • 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-06-05T15:22:47+00:00Added an answer on June 5, 2026 at 3:22 pm

    The problem is that in function updatelogin($lastlogin) you have not defined what $email will hold.

    IF you echo your query after your query update statement (after $query = UPDATE .....)

    echo $query
    

    you will see what your problem is.

    Update 1

    I think you should have something like this before $query statement
    $email=$details_arr['email'];

    OR

    pass $email value in function as updatelogin($lastlogin, $email)

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

Sidebar

Related Questions

I want update object with linq to entities, like this : public ActionResult SubmitPool(SwimmingPool
I want to update my table so that every column that has a value
I want to update date Field when any row updated. Means whenever I update
I want to update three column namely LCID,LCNo, AmendmentStatus which are select from PI
I want to update two fields using counterCache in CakePHP 2.x. I tried this
I want to update Extjs window bbar(toolbar) dynamically, but I don't know how should
i want to update my sqlite database but i cannot find the way to
i want update my row and concat my string but i have an error
I am performing this request, and I get the results I want: UPDATE sales
POSTGRES- I want update the Employees.zipcode_mod column in the Employees table for the 'invalid

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.