Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

What's the best way to enter new fields for the following data?

Quote Reply
What's the best way to enter new fields for the following data?
Hi,
I have a a Links SQl database. For one of the records, the user has the option to enter up to 55 playing cards, each card is entered into a seperate field. There is also seperate fields (columns) for a price field for them to enter a price tag.

I now need to enter one more field, which will be a checkbox, one checkbox for each card that they enter, and it will only have one option.

So let me see if I can show how this looks:

Qty Card Name Price Foil

Qty is a column in the database (one column per card such as card1qty, card2qty, card3qty etc up to card55qty)
Card Name is a column in the database (one column per card such as cardname1, cardname2, cardname3 etc up to cardname55)
Price is a column in the database (one column per cards such as card1price, card2price, card3price etc up to card55price)

Now I need to add a new column for the option of the Foil option, and it will be a checkbox with only one option (either yes or no).

Do I need to do as I've been doing, and add those extra 55 fields, one for each item that they enter or is there a better and more expedient way of entering such mass amount of columns in maybe just one column somehow?

I was thinking that maybe it could be simply one column to hold all 55 checkbox options, since checkboxes are usually meant for multiple selections for one record, maybe someone could tell me what the best method is to do this and give me an example of how the html might look for it as well as anything I must enter into the new links column properties.

It's not mandatory for the user to enter the checkmark, if they do enter it, then it's assumed to be yes.

Thanks, I hope I made this clear, it's not easy for me to do so.
Quote Reply
Re: [Westin] What's the best way to enter new fields for the following data? In reply to
Mmm, from what I understand of your post, I think its gonna be a case of adding another field for every one :( (you would have been a lot better just writing a simple plugin to to loop through from 1-55, and adding the extra fields that way =))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What's the best way to enter new fields for the following data? In reply to
Ok, and I assume theres no php or cgi scripts out there that could help to automate it to some degree like giving a script some parameters like
Start first column name: card1foil
amount of columns to add: 55
Type of Column: Text
Names: Same as column name
Type: Text

Something like that to quickly automate adding 55 fields at a time? i ask because I know there will be more columns that I will need to add for these existing fields.

Maybe some sort of simple mysql commands that could automate it partially, and then have the links sql resync with the mysql database maybe?

Im probably grasping at straws because Im so tired of adding these columns one at a time through the links sql interface.
Quote Reply
Re: [Westin] What's the best way to enter new fields for the following data? In reply to
I'll write something quick for ya ;)

What exactly is it - just a basic TEXT fields (CHAR(255) ?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What's the best way to enter new fields for the following data? In reply to
Yes

Thank you,

Last edited by:

Westin: May 2, 2009, 1:31 AM
Quote Reply
Re: [Westin] What's the best way to enter new fields for the following data? In reply to
Ok, please give the attached a go. Simply install the plugin, then run the new "Do Adding" function on the left frame.

The rest should be pretty simple :)

Hope that makes your life a LOT easier Cool

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What's the best way to enter new fields for the following data? In reply to
Worked perfectly Andy.

It will indeed make my life a LOT easier as well as give me the incentive now to continue enhancing our service knowing that I can now spend more of my time thinking up ways to enhance our service instead of thinking of the time I will have to spend doing nothing but adding simple text columns to get more information store *to* enhance our service.

Again, much appreciated.
Quote Reply
Re: [Westin] What's the best way to enter new fields for the following data? In reply to
Np - glad it worked. Hopefully will be of some use to other people too, trying the same thing =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] What's the best way to enter new fields for the following data? In reply to
Hi Andy,

Can you please change the field from Char 255 to just Text

I have a great deal of columns (already 287 and counting) and just got a failure message:
Code:

Failed to execute query: 'ALTER TABLE magicdeck_Links ADD conditioncard27 CHAR(255)':
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535.
You have to change some columns to TEXT or BLOBs at /home/../admin/Plugins/QuickAddFields.pm line 110.

Quote Reply
Re: [Westin] What's the best way to enter new fields for the following data? In reply to
Found out that I could do that myself by editing the plugin before installing it. So no worries for me, if someone else needs it to be a text field instead of the Char field you too can edit the plugin (.pm file) to switch Char to Text and 255 to blank.
Quote Reply
Re: [Westin] What's the best way to enter new fields for the following data? In reply to
Yup, or you can edit it in /admin/Plugins/ :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!