a question regarding the 'Three drop down list demo'

flyingcow
05:05:12
a question regarding the 'Three drop down list demo'

This is a very nice demo. I wanted to expand it to a bigger application. Still three dependent dropdownlists, but the first level may have tens (100), the second level has different 20 values shared by first level values, and the third one will be 10,000 in total. The data is stored in a sql database's first three columns with other columns storing other values for the row to be defined by the 1st/2nd/3rd level values.

I am wondering
(1) can this demo code handle the data considering its many more items;
(2) if the all data are stored in one single sql database table but three tables as used in the demo, how to realize the same function? Using the filter in Excel, the conditional selection is pretty simple. Can this demo do that?

Thanks...
smo1234
05-06-2012
It can be done like it is done in Excel.
You can keep the three drop down list collecting data from the single database table. These drop downs list need not be linked to each other. After collecting thee drop down data , you can develop a sql to get the matching record from the table. For example

select * FROM table_name WHERE column1='$list1' AND column2='$list2' AND column3='$list3'

In above query you can use OR in place of AND if required.
flyingcow
05-06-2012
Thanks for your reply.

For the 1st and 2nd columns, there would have lots of repeating values (the data row differentiates at the third column and the data thereafter). Is it possible to develop a dropdownlist using the 1st and 2nd column's all different values only? How to sort out the distinctive values only, so that the dropdownlist for the 1st and 2nd level will tens (100) and 20 only?

If possible, how efficient would it be? If the sql table is 100000 rows?

Thanks a lot...
smo1234
05-06-2012
While populating data for 1st and 2nd drop down list you can use sql distinct to get unique data from the table columns. Then SQL can pickup records matching the data of three drop down lists.
Please Login to post your reply or start a new topic