Gossamer Forum
Home : Products : Gossamer Links : Discussions :

replacing 'select' field with a 'smallint' field

Quote Reply
replacing 'select' field with a 'smallint' field
Hi

in the Links database, is there an 'easy' way to replace a 'select field' with a 'smallint' field?

At present I use a 'select' field for one of the Links database fields: 'price' with values like this: £30, £40, £50 etc

So I have 400 records with valuse like: £30, £40, £50 etc...

I would like to replace this with a combination of 'currency' select field & a 'smallint' input field for 'price_new'

Select: GBP £ or EUR €
Value (price_new): 123

I know how to add fields, edit the relevant html template pages etc.

But in doing this, the new field 'price_new' to be dislayed on the link and deatiled page will be empty for the 400 records?

Is there some easy work around for this?

Would something like this work?

<input type="text" id="price_new" name="price_new" value="<%if price_new%><%escape_html price_new%><%else%><%price%><%endif%>" class="text" />

any help / advice appreciated

Thanks
Colin Thompson
Quote Reply
Re: [colintho] replacing 'select' field with a 'smallint' field In reply to
To be honest, you would be better just having 2 new fields

SELECT / Currency / CHAR(4)
SELECT / ThePrice / INT(5)

Then, have all your values put in.

Then, have a script get the values from your current field (which has the prices in), and "split" them up .

For example:

£50

..gets split into :

Currency => £
Amount => 50

Then, update these new fields.

This saves you messing up your current database entries =)

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] replacing 'select' field with a 'smallint' field In reply to
Andy

that sounds like a good idea!


Would the 'currency' field would need a different name, as in the past I've used 'currency' as a field name and it effects the paypal payment process.


Thanks
Colin Thompson

Last edited by:

colintho: May 8, 2008, 8:52 AM