0

I'm currently working on a log-out system, which will record users when they logged out. But it's not updating properly.

Code:

<?php
include('global.php');
        $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and 
        password='$mypassword'";
    $result=mysql_query($sql);
    while($row=mysql_fetch_array($result))

        {
    $logintime=$row['logintime'];
    }


        if(mysql_num_rows($result))
        {

        $query = "UPDATE time_tb SET ";


            $query = $query."logoutime='".$p_time."' ";

            $query = $query."WHERE logintime='".$logintime."'"; 

            ExecuteQuery($query);




session_destroy();
header ("location: loginadmin.php");
            }
?>
Rizier123
  • 58,877
  • 16
  • 101
  • 156
codeSeven
  • 479
  • 5
  • 23

1 Answers1

0

try this

 $query = "UPDATE time_tb SET ";
 $query.="logoutime=".$p_time." WHERE logintime=".$logintime;

And yes you should check your sql query in console by using print_r or others in your code.

urfusion
  • 5,528
  • 5
  • 50
  • 87