0

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);
Aishwarya R
  • 647
  • 2
  • 12
  • 25

2 Answers2

1

You are using in an incorrect way.

Try this:

$query3 = mysql_query("update table register set  bal=(bal-$tax) where name='$user'" , $connection);
o-90
  • 17,045
  • 10
  • 39
  • 63
Manish Shukla
  • 1,355
  • 2
  • 8
  • 21
0

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

Val K
  • 375
  • 2
  • 9