Hi
I am trying to update time in same row, but it's not updating negative time properly
can anyone tell me solution of this query?
mysql_query("update daily_timerecord set FLEX_BALANCE=ADDTIME(FLEX_BALANCE,SEC_TO_TIME($total)) where EMPLOYEE_ID=$id and UPDATE_DATE > '$date' and UPDATE_DATE <= CURDATE()")
in this query FLEX_BALANCE may have "-01:00:00" value but this query runs properly in phpmyadmin but not running through php code...
Thanks
Proble with update query
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Make certain your $id, $total and $date variables have a value, and run your query this way:
Note the quotation marks around $total - not clear as to what sort of data that is.
Code: Select all
$sql= "
UPDATE daily_timerecord
SET FLEX_BALANCE = ADDTIME(FLEX_BALANCE,SEC_TO_TIME('$total'))
WHERE EMPLOYEE_ID=$id
AND UPDATE_DATE > '$date'
AND UPDATE_DATE <= CURDATE()
";
$result= mysql_query($sql) OR die( 'QUERY ERROR:<br />' .$sql. '<br />' .mysql_error() );