This is the code: <?php $conn = mysql_connect("xxx","xxx","xxx"); mysql_select_db("xxx",$conn); if ($_COOKIE["user"]) { $ID=$_COOKIE["user"]; $SQL = "Select * From ClientData Where ID = ".$ID; $result = mysql_query($SQL); if ($result <> "") { $row = mysql_fetch_row($result); $Msg = "Welcome back $row[1]!"; $SQL = "Update Tracking Set Return = Return + 1"; if ($row[1]) { $SQL = "Update Tracking Set Client = Client + 1"; } } } else { $ID = mt_rand(0,9999999999); setcookie("Brag_Flag_user",$ID, time()+(60*60*24*30)); $SQL = "Insert Into ClientData (ID) Values ('".$ID."')"; mysql_query($SQL); $Msg = "Welcome to"; $SQL = "Update Tracking Set First = First + 1"; } [COLOR="Red"] echo $SQL; mysql_query($SQL); [/COLOR] ?> Code (markup): The SQL statement works fine in mysql manager (cut and paste "echo" from page) but not in code!
Update Tracking Set Return = Return + 1 This is where error is, how should I increment value of "Return" column?
cont911 is right. There are a set of mysql reserved keywords. The query you have written, is something of this kind UPDATE Tracking set UPDATE = UPDATE + 1. Just imagine this. This looks so foolish. What you have done is something like this. Just google "Mysql reserved keywords" and you will know the reserved keywords for mysql.