Hi,

Saturday, January 4, 2003, 3:23:37 AM, you wrote:
FML> -----Original Message-----
FML> From: Daevid Vincent
FML> To: [EMAIL PROTECTED]

FML> echo "action = ".$_POST[action]."<BR>";
FML> if ($_POST[action] == "1" || $_POST[action] == "0")
FML>   echo = "UPDATE Company SET Enabled = ".!(intval($_POST[action]))."
FML> WHERE CompanyID = $id";

FML> I cannot figure out how to simply make the 0 and 1 invert or negate or
FML> toggle as it were.
FML> --------------------------

FML> echo = "UPDATE Company SET Enabled = ".(1-$_POST[action]) ...

FML> Cheers!

FML> Mike

In mysql you can use the invert (tilde)operator like this:

select 5 & ~1 returns 4 so you could do

"UPDATE Company SET Enabled = (Enabled & ~1)"   which will toggle bit 1 of
Enabled.

(Untested :)



-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to