Hey Sxooter. Ive been trying that, and when i manually run the queries through the sql console, it works fine.
However when executed in my php code, it gets a little jumbled.
Im not using auto_increment for my ID column.
$sql = "UPDATE hunt SET mapid = '$qry[mapid]',
locationid = 0
WHERE locationid =$first_location_id AND mapid =$qry[mapid]";
if ( ($result = mysql_query($sql)) == 0 )
{
echo " ERROR 1";
}
// update second row with first id
$sql = "UPDATE hunt SET mapid = '$qry[mapid]',
locationid = $first_location_id
WHERE locationid =$second_location_id AND mapid =$qry[mapid]";
if ( ($result = mysql_query($sql)) == 0 )
{
echo " ERROR 2";
}
// update first row with second id
$sql = "UPDATE hunt SET mapid = '$qry[mapid]',
locationid = $second_location_id
WHERE locationid =0 AND mapid =$qry[mapid]";
if ( ($result = mysql_query($sql)) == 0 )
{
echo " ERROR 3";
}
The first 2 queries work fine, but when it comes to changing the row with ID '0', the locatonid changes fine, but instead of the other columns staying as they were, they all seem to inherit the values that were in the other row?? eh?