note 52352 added to ref.gmp
| From: | sabatadotmereeotlheatgmaildotcom at osu1 dot php dot net | Date: | Thu, 28 Apr 2005 14:44:57 +0000 |
| Subject: | note 52352 added to ref.gmp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88694@lists.php.net to get a copy of this message | ||
I did further research and figured out a solution, that i felt was sufficient for the purpose I
wanted it for which was, I needed to change a binary representation in a db to signal user overall
status within the system for multi statuses eg: check that they have received a comfirmation email
or has been banned or rejected and so on whatever you need to signal
PS: the script below is if you using ADOdb with PHP 5.0.4 not tested else where under Windows XP SP2
like in my instance
<<<<<<<<<<=============>>>>>>>>>>>>>
<?php
function change_status($users_id, $change_flag, $conn)
{
$sql = sprintf("SELECT users_status
FROM users where users_id = users_id");
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = &$conn->Execute($sql);
foreach($rs as $k => $row)
{
$record = $row[0];
}
$xor1 = base_convert($record, 2, 10);
$xor2 = base_convert($change, 2, 10);
$xor3 = ((int)$xor1 ^ (int)$xor2);
$xor4 = sprintf("%b", $xor3);
$sql = sprintf("UPDATE users
SET users_status = '$xor4'
WHERE users_id = $users_id");
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
$rs = &$conn->Execute($sql);
}
//accessing the function:
change_status(1, "1010101010101", $conn);
?>
==========================
i hope some has the same problem I had and finds this useful...
;-)
----
Manual Page -- http://www.php.net/manual/en/ref.gmp.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52352
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52352&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52352&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52352&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52352&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52352&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52352&report=yes
Search -- http://master.php.net/manage/user-notes.php