0

When I use these statements works:

$sql = "UPDATE nametable SET column = '$number' WHERE username = '$text'";
$result = mysql_query($sql, $link) or die(mysql_error());

But, when I change 'column' to 'option1' like this:

$sql = "UPDATE nametable SET '$option1' = '$number' WHERE username = '$text'";

The query doesn't work. What's wrong with $option1? :/

Thanks!

1 Answers1

0

column names must not be enclosed by quotes '

$sql = "UPDATE nametable SET " . $option1 . " = '$number' WHERE username = '$text'";
baao
  • 71,625
  • 17
  • 143
  • 203