Jump to content

[SOLVED] <option values> in mysql


graham23s

Recommended Posts

Hi Guys,

 

i have noticed nearly all other sites do this when storing option values into mysql

 

example

 

<option value="1">United Kingdom</option>

 

i usually do this:

 

<option value="United Kingdom">United Kingdom</option>

 

is there any advantages to doing the first one as opposed to the second? also how would i echo out the country name just going by a number?

 

thanks guys

 

Graham

Link to comment
Share on other sites

it normalizes the tables in mysql. 

 

the table that contains the info for the values would have an id which is the value and the description.

 

ID          Description

1            United Kingdom

2            USA

3            Russia

 

then the ID is stored into another table.

 

column1  column2  column3  country_id

info        info        info        2

info        info        info        1

info        info        info        3

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.