The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Checkboxes -> Database
How would I go about doing this:
Insert checked checkboxes into database as a set (into text field), the only complication is the # of checkboxes is an unknown, as there is one for every 'player' in the player table (values are IDs). The names of the fields all are: positionXXX (where XXX = playeriD). Sorry if this is yet another easy question, my brain shuts off sometimes. |
#2
|
|||
|
|||
You should name your fields as an array ie position[].
Then you can just serialize the array into the database field. |
#3
|
||||
|
||||
Okay, I set them as position[$id], what do you mean by serialize the array?
|
#4
|
|||
|
|||
PHP Code:
|
#5
|
||||
|
||||
Could someone elaborate on this a little for me. Do I create the array first? and do I name them $position[$id] or just position[$id] (if position[$id] how does it know what $position is?)
|
#6
|
|||
|
|||
You name the field in your form 'position[]' (or 'position[$id]' if the Id is relevant).
After submit your would do a: PHP Code:
|
#7
|
||||
|
||||
Thanks for all the help so far.
2 small problems (I hope): I have a select menu of all the players, I want to restrict the players by only showing results where FIND_IN_SET('$id', fieldname) but I need the $id to be the current $id that mysql is processing, the other problem is, if the id is 1, 11, 21, 108, and 3081, all of these will be included. Is there a way to force X # of digits? If this makes the first problem easier, the field containing the string of numbers (ex: 1,3,4,25,234234,3563) is in another table, which is selected prior to all of this. |
#8
|
|||
|
|||
Sorry you lost me now.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|