I'm trying to use a variable in a Update to a field.
The variable will change the amount of the increment that occurs in that field.
I can't use a fixed amount, as it will change according to the user.

The Following won't work

$points = 5;
$query2 = "UPDATE `Cust` SET points = points + $points WHERE name = '$name'";
$result = mysql_query($query2);

What am I doing wrong with the above query?

Yet this one does work
$query2 = "UPDATE `Cust` SET points = points + 5 WHERE name = '$name'";
$result = mysql_query($query2);

Thank you
Ray Ward
ray@lauray.net

Didn't tested it, but I think, you are missing quotes, try this:

$points = 5;
$query2 = "UPDATE `Cust` SET points = points + '$points' WHERE name = '$name'";
$result = mysql_query($query2);

Note: Now I have tested it, its working :)

Didn't tested it, but I think, you are missing quotes, try this:

$points = 5;
$query2 = "UPDATE `Cust` SET points = points + '$points' WHERE name = '$name'";
$result = mysql_query($query2);

Note: Now I have tested it, its working :)

Thank You! It works great....
Ray