homepage Welcome to WebmasterWorld Guest from 54.205.247.203
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
Storing Data in MySQL
magneto




msg:4235456
 10:12 pm on Nov 26, 2010 (gmt 0)

Hello,

I have a form that combines java script and php to make calculations and then stores them in a database. On my tables, i have different options the user can select. For example, the 2 ton Unit has a value of 1492.
<option value="1492">2 Ton Unit</option>

My problem is that when values are being passed on to the database, it automatically passes the "value" instead of the name which makes sense. However, I would like "2 Ton Unit" to be stored instead of the number. Any suggestions to make this happen? I then send an email to the user with his/her selections and all they see is numbers which don't make a lot of sense.

Thanks people.

 

LifeinAsia




msg:4237113
 11:16 pm on Nov 30, 2010 (gmt 0)

Create a lookup table that matches the numeric value with the text description. Something like:
UnitID Description
------ -----------
1492 2 Ton Unit

In most cases, you want to store the actual numeric value in your database- numeric values are faster to search and you don't need to change all your data if the description changes (you just make one change in the lookup table).

magneto




msg:4238245
 7:49 am on Dec 3, 2010 (gmt 0)

hello and thanks for your reply. could you please take a look at my new post. i think i have explained my problem a little better. thanks

[webmasterworld.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved