I want to update 'duration' and 'end_time' field in same query/action. 'end_time' field filled current time, 'duration' field filled from different minute between 'start' and 'end_time' field. when i execute this update, the result in 'duration' field is 0. How to get end_time and duration in same time.
this is the php code :
<?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 '<script language="javascript">window.location = "../?p=los"</script>';
} ?>