title: Update end time and duration in same time, using TIMESTAMPDIFF PHP MYSQL
body: <p>I want to update '<strong>duration</strong>' and '<strong>end_time</strong>' field in same query/action. '<strong>end_time</strong>' field filled current time, '<strong>duration</strong>' field filled from different minute between '<strong>start</strong>' and '<strong>end_time</strong>' field. when i execute this update, the result in '<strong>duration</strong>' field is 0. How to get end_time and duration in same time. </p>
  
  <p>this is the php code : </p>
  
  <pre><code>&lt;?php
  include("koneksi.php");
  $id     = $_GET['id'];
  $start  = gmdate("Y-m-d H:i:s", time()+60*60*7);
  $end_time   = gmdate("Y-m-d H:i:s", time()+60*60*7);
  $duration  = $_POST['duration'];
  
  
  $query = "update billing set end_time='$end_time', duration = TIMESTAMPDIFF(MINUTE, '$start', '$end_time') where id='$id'";
  
  $result = mysql_query($query);
  if ($result){
  echo '&lt;script language="javascript"&gt;window.location = "../?p=los"&lt;/script&gt;'; 
  } ?&gt;
  </code></pre>