I have a MySQL database with a value in a certain row and a certain column. I use the 'update' query to update it (obviously). Now, how would I do this: I have a numerical a value in a column, and I want to add to that number a number from a form. I know in C, this is done like this:
current=current+variable;
The two "currents" are the same (they are in my db), and the variable comes from the form. Right now, I have this:
$query = "UPDATE roster SET hours = '$hours' WHERE callsign='$callsign'";
$resultat = mysql_db_query($db, $query, $connection) or
die("Error in query." .mysql_error());
}
I want this: (notice hours)
$query = "UPDATE roster SET hours = hours+'$hours' WHERE callsign='$callsign'";
$resultat = mysql_db_query($db, $query, $connection) or
die("Error in query." .mysql_error());
}
This syntax does not work. Can anyone tell me how to do this properly?