I have a php code which sums up the value of the same column from two different tables of same database and stores it in a variable. The code is mentioned below:
$sql = 'SELECT
(SELECT SUM( time_spent )
FROM '.TICKET_RESPONSE_TABLE.'
WHERE ticket_id='.db_input($id).')
+(SELECT SUM( time_spent )
FROM '.TICKET_NOTE_TABLE.'
WHERE ticket_id='.db_input($id).')
AS total_time';
$result = db_query($sql);
$cursor = mysql_fetch_row($result);
$total_time = $cursor[0];
Now,I want is to update a column in another table of the same database, with the value stored in the variable $total_time. Kindly help me with the same.