graham23s Posted May 8, 2007 Share Posted May 8, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/50494-solved-in-mysql/ Share on other sites More sharing options...
pikemsu28 Posted May 8, 2007 Share Posted May 8, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/50494-solved-in-mysql/#findComment-248075 Share on other sites More sharing options...
graham23s Posted May 8, 2007 Author Share Posted May 8, 2007 ah i see, is it acceptable to do it the i was above at all? cheers Graham Quote Link to comment https://forums.phpfreaks.com/topic/50494-solved-in-mysql/#findComment-248079 Share on other sites More sharing options...
taith Posted May 8, 2007 Share Posted May 8, 2007 yes... it works perfectly fine... but it is also completly unnecessary... Quote Link to comment https://forums.phpfreaks.com/topic/50494-solved-in-mysql/#findComment-248082 Share on other sites More sharing options...
graham23s Posted May 8, 2007 Author Share Posted May 8, 2007 Thanks for the input guys, i'm not exactly noob but not intermediate either i know ill look back at this code in months to come and laugh lol cheers Graham Quote Link to comment https://forums.phpfreaks.com/topic/50494-solved-in-mysql/#findComment-248090 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.