I have a certain column in a table that stores a number. I want this number to be set to 2 ONLY if it previously equaled 1. I was wondering if it was possible to avoid this:
$val = mysql_fetch_row(mysql_query("SELECT columnA FROM tableName WHERE something = '$someValue'"));
if($val[0] == 1) { .....UPDATE tableName SET columnA = 2....... }
Is it possible to directly query the database? With something like this:
SET columnA = 2 if columnA = 1