Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

store combobox info

 
   Database Forums (Home) -> PHP SQL RSS
Next:  Inserting values in high quantity in database  
Author Message
Roderik

External


Since: Aug 23, 2008
Posts: 1



(Msg. 1) Posted: Sat Aug 23, 2008 11:03 pm
Post subject: store combobox info
Archived from groups: alt>php>sql (more info?)

I'd like to store the information to generate a combobox (drop down
menu) in the MySQL database. What is a good way to do this. Store the
name, value pairs in a separate table apart from the combobox-question
table or store it in a VARCHAR field as a JSON value?
Or maybe another way?

 >> Stay informed about: store combobox info 
Back to top
Login to vote
J.O. Aho

External


Since: Dec 01, 2003
Posts: 397



(Msg. 2) Posted: Sun Aug 24, 2008 2:46 am
Post subject: Re: store combobox info [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Roderik wrote:
> I'd like to store the information to generate a combobox (drop down
> menu) in the MySQL database. What is a good way to do this. Store the
> name, value pairs in a separate table apart from the combobox-question
> table or store it in a VARCHAR field as a JSON value?
> Or maybe another way?

IMHO it's best to have a table from where you draw the information used in the
drop down menu, as it's usually a lot easier to manipulate the information in
a good way directly in the database instead of having to do filtering/sorting
in the javascript/jscript.
You don't need to have one table per drop down menu (in case the drop downs
are unrelated to any other data in the database), you can have one table where
you could for example have three columns: name, value, dropdownmenu

Usually the data in the drop down tables are related to the data in the
database, then you can fetch it from the table where it's already stored,
using the row id as the value and the name column (can sometimes require a
join or so).

If the drop down menu is statical, then maybe it's far better just let it be
in the html and not use database at all.

--

//Aho

 >> Stay informed about: store combobox info 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
trouble doing a join using WHERE and getting the right inf.. - I can not get the following SQL right. But then, I don't SQL that well. If anyone can help out, I'll be grateful. I a site where people can post links to things they like, and put tags on those links. They can also leave comments for each of the links. ...

Looping INSERT from checkbox info - I am trying to insert info if a checkbox is selected. The checkboxes are created from this code (pulled from mysql): ########## $ministry_info_query = "SELECT * FROM ministries WHERE inactive = 0 ORDER BY title"; // selecting all ministries ...

multiple column sort MySQL - I am using $qryResult = mysql_query("ALTER TABLE MyTable ORDER BY County"); But I would like it sorted by multiple columns such as $qryResult = mysql_query("ALTER TABLE MyTable ORDER BY County"); $qryResult = mysql_query("ALT...

One query and problem LIMIT - Hi all, I have 2 tables: articles and categories articles table: ------------ articleid categoryid name categories table: --------------- categotyid name description I want to get the last entred 5 articles for each category with one quey: like..

multiple select but ......php/mysql/html - hello, Maybe someone can help me out with this one where i am stuck where i solve this in html or other code? html/php and mysql using in a html form: <tr> <td><?php echo"<font face=$b_fontface size=$b_fontsize&...
   Database Forums (Home) -> PHP SQL All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]