-2

The update statement needs to change the balance of user.

update register set bal=(bal-$tax) where name=$user

but it is showing the error atUnknown column in 'where clause'

Table structure:
name   ||   password   ||   bal
karan12   karan123    6000
mitul           5454           9000

Query:
$q= mysql_query("update register set bal=(bal-$tax) where name=$user" , $connection) or die("Select Query failed: ".mysql_error());

Error:

Unknown column 'mitul' in 'where clause'

Aishwarya R
  • 647
  • 2
  • 12
  • 25

1 Answers1

5

I think your name column is Varchar then you should enclose the variable $user into a quotation

update register set bal=(bal-$tax) where name='".$user."'