Here's one way.
*Note that this uses a subquery and you must be running MySQL 4.1 or newer in order to have support for subqueries.*
Suppose you've a table created with
CREATE TABLE enums (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
col ENUM('yes','no') NOT NULL DEFAULT 'yes'
) ENGINE=MYISAM DEFAULT CHARSET=latin1;
Then for a given record whose id is the value of the variable $id, you can toggle the value for its col column using this:
$update_query = "UPDATE enums SET col=(SELECT CASE col WHEN 'yes' THEN 'no' ELSE 'yes' END) WHERE id='$id'";
You could perform the same logic in the PHP code instead (and you must do so if you're using MySQL 4.0 or earlier), but I think that this is a bit neater. ;)
To do that, you'd need something like this:
$update_query = "UPDATE enums SET col=" . ($enum == 'yes' ? 'no' : 'yes') . " WHERE $id='$id'";
Jon Stephens
MySQL Documentation Team @ Oracle
MySQL Dev Zone
MySQL Server Documentation
Oracle