Help - Search - Members - Calendar
Full Version: Better To Save The Option Or The Value Of A Option ?
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
MrTouz
Well i have a HUGE form... wich includs around 2000 diferent answers devided by around 8 so you can choose around 8 "options" at a time + add text to a text area.

(its confusing at first i know.. and i cant explain correctly)

___

What i need to know, is it not Faster (for search) Lighter (as fat) Easyer (to understand) and cleaner safer to give a VALUE to each of my answers than leting the answers idrectly be saved inside the database ? so for example and live preview :

<option>I love My Self</option>
<option>I Love Coding</option>
<option>Lets Go Party Tonight</option>
<option>Php Is Hard In The Head</option>

better above or :

<option value="1">I love My Self</option>
<option value="2">I Love Coding</option>
<option value="3">Lets Go Party Tonight</option>
<option value="4">Php Is Hard In The Head</option>

______

I mean once the guy is going to hit the button, its gonna save inside my database eather the "i love my self" OR if i have set a value to it its gonna save the value ! ? right ?

coz if its saves the value lets say " 1 " than :

- it saves less text (well between : 1 and : i love my self)
- its faster (once he hits the button less caracters will be saved right ?)
- its fast (once we do a search its faster to search because we are searching for Small values ? right ?)

______

i wouldnt be thinking of this if i had a small tiny form but my form is around 2500 lines :/ around 2000 lines for the Option, its basicly a form with ALL the way of moving inside france ... BUS ? TRAMWAY ? RER ? TGV ? RER ? Thalys ? EUROSTAR well ALL the ways someone can move around france... so its a LOTS of infos and i prefer save less inside my server than ave a full text... i can devide by 1000 the fat of my infos and i think its a wayyyy fast to do it even tho i have to set a value for the 2000 options... it nothing for me...

________

Thanks for the answers, if you have any other suggestions to maek things easyer... well also, huh please detail what you guys are saying because i basicly SUCK at php i just cant beleive i made work a huge forumlar already... my head is about to explode so if you could of explain it easyly and give direct example... like lines of codes or i donno smile.gif

Thanks... much apreciated!!! (seriously)
Ed
Definitely integers, the integer being a relational index key to another table storing the different modes of transport (or what ever you are handling).

You can then just use joins to retrieve that string value from the database not only that but you optimize indexing because they're stored as integers.
MrTouz
ok is INTEGERS the "value" well the PHP definition of what i call in HTMl Value ? liek i said i kinda suck at PHP.

Also, if i set Integers im about to put numbers as it... so inside my database i only put as Alphabetical numbers since there is no text saved smile.gif ? biggrin.gif

Thanks for the answer !
Ed
Not quite sure on your question, but you store the column as an 'INT' type column.
EMOruffino
QUOTE(MrTouz @ Oct 21 2007, 10:47 AM) *
ok is INTEGERS the "value" well the PHP definition of what i call in HTMl Value ? liek i said i kinda suck at PHP.

Also, if i set Integers im about to put numbers as it... so inside my database i only put as Alphabetical numbers since there is no text saved smile.gif ? biggrin.gif

Thanks for the answer !


yes.....
im pretty sure yes....... (still reading up on the whole mysql wink.gif )
MrTouz
ive been told that its better for a search database to use a text meaning leting the database save my <option>Hello There</option> than saving the Value of this Hello there :/

so i guess ill leave it the way it is :/
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.