title: Updating data in MySQL database
body: <p>I am having problem updating an existing row in my database. What I need to do is add a record to a field named "Time_Out". This field is on the same row as with the "Time_In", "username", and "date_added". The Time_In is working perfectly fine. This is the code I've used:</p>
  
  <pre><code>date_default_timezone_set('Asia/Taipei'); 
  $date_added = date ("Y-m-d");
  $time_added = date ("h:i:s:a:");
  $user = $_SESSION['xxxx']['xxxxx'];
  $con = mysqli_connect("localhost", "xxxx", "xxxx", "test");
  $save = mysqli_query($con, "INSERT INTO time_logs (username, date_added, Time_In) VALUES('$user', '$date_added', '$time_added')");
  if(!$con) {
      die('Could not connect to the database' . mysql_error());
      mysql_close($con);
  }
  else
      header("Location: etc.php");
  </code></pre>
  
  <p>For the Time_Out, I have removed the "INSERT INTO ..." line and changed it into:</p>
  
  <pre><code>$save = mysqli_query($con, "UPDATE time_logs SET Time_Out = $time_added WHERE username = $user");
  </code></pre>
  
  <p>but the record in the Time_Out field in my database is still showing 0:00.
  By the way, my date_added is set to Date and the Time_In and Time_Out is set to Time.</p>
  
  <p>I would really appreciate it if someone could show me how to do this using PHP. Thank you in advance.</p>