|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Oct 2003
Location: Florida
Posts: 287
|
bitfields tutorial
vBulletin uses what they call bitfields in there system. Basicly you can have multiple settings within one database field. Is there any tutorial out there to show how one can do such a thing to custom scripts?
I always notice.. PHP Code:
|
|
|
|
|
|
#2 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2006
Location: Ventura, CA
Posts: 2,837
|
Ok, this explanation should do it:
http://www.zend.com/zend/spotlight/c...lery-wade2.php basically, you take an integer with a certain bit length, and you flag on/off certain bits to indicate permissions/etc. This is done through the various php bitwise operators: http://us3.php.net/manual/en/languag...rs.bitwise.php This is mainly done to save storage space. Though some people find it hard to work with on the database level, as they have to reference back and forth between the db and PHP code, which, for a DB admin who doesn't deal with PHP much, that can be quite painful . That said, if you're the one dealing with both the DB and the code, it's all you. However, if you have a DB admin, be considerate . |
|
|
|
|
|
#3 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Oct 2003
Location: Florida
Posts: 287
|
I deal with everything, so this should do well for me. Thanks alot Chris!
/me starts to read away!
Edit: This cartoon really helped alot. I want to post it here for other users. ![]() source: http://www.litfuel.net/tutorials/bitwise.htm |
|
|
|
|
|
#4 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2006
Location: Ventura, CA
Posts: 2,837
|
hahaha, what.. on.. earth... I am so bookmarking that, that's the greatest
. Oh and btw, spiral is awesome ( at least I think that's where that character is from.. ). |
|
|
|
|
|
#5 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Oct 2003
Location: Florida
Posts: 287
|
I thought you might get a kick out of that.
![]() |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 00:58.






. That said, if you're the one dealing with both the DB and the code, it's all you. However, if you have a DB admin, be considerate
.
. Oh and btw, spiral is awesome ( at least I think that's where that character is from.. ).


Hybrid Mode
