如何更新列的值作为sql中两个变量之间的差异?

Here, update chooses bal(for balance) column of register table whose is to be changed to difference of bal and the value in variable $tax for only the row saisfying the condition. It's not working in following code.How to do it?

$query3 = mysql_query('update table register set  bal=bal-'.$tax.' where name='.$user.')' , $connection);

You are using in an incorrect way.

Try this:

$query3 = mysql_query("update table register set  bal=(bal-$tax) where name='$user'" , $connection);

It seems, there is extra ')' after user, that hasn't '('