Hi,
I am trying to swap 2 field values from 2 rows in the same table.
What I have done is write these 2 queries
$query = "UPDATE photo_category SET Cat_Sort=$newSort where CatId=$categoryID";
mysql_query($query) or die(mysql_error());
$query = "UPDATE photo_category SET Cat_Sort=$catSort where CatId=$datSel[0]";
mysql_query($query) or die(mysql_error());
where $newSort is $catSort-1 and $categoryID and $datSel[0] are primary keys for the 2 rows.
But what happens is only the field from the second query gets updated. The first query does not UPDATE the field CAT_SORT.
Is it that in MySQL I can run UPDATE only once or what am I doing wrong here?
if u have a better solution, let me know.
thanks