php - updating the lastlogin column value in mysql -


i want update lastlogin column value .i wrote code ,but column nt updated .i wrote code in main.js inserting query.here didnt wrote code updating lastlogin column value in main.js. updating lastlogin column wrote updatelogin function in dbfunc.php below.

function updatelogin($lastlogin)     {          alert("hi");         $query="update users set last_login='$lastlogin' 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 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 1 tell me ,why lastlogin column isnt updated in db

the problem in function updatelogin($lastlogin) have not defined $email hold.

if echo query after query update statement (after $query = update .....)

echo $query 

you see problem is.

update 1

i think should have before $query statement
$email=$details_arr['email'];

or

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


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -