Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

populating a combo from database

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

populating a combo from database

Postby buspass » Sun Mar 23, 2003 2:06 am

I have an html form which contains two drop downs.

Each drop down will have several thousand items (maybe upto 25,000)

I don't want to hard code the items into the HTML as the page will take ages to load. I think the answer is to populate the combo's from a database.

This raises a couple of questions:

1. Would this be more efficient than hard coding the items in the HTML?

2. How would I prevent the page re- querying the database upon page refresh? In otherwords, once the combo has been populated, there is no need to populate it again.

Has anyone got any thoughts on this, or has anyone done something like this before, and if so what was your solution?

Thanks
buspass
New php-forum User
New php-forum User
 
Posts: 9
Joined: Sun Mar 09, 2003 2:20 am

Postby mcandrey » Tue Mar 25, 2003 6:33 am

First of all please note that is not recomended to populate a combo or any other form element with such many records .... maybe up to 30 is more than enough.

I think that is not possible to submit a form and to not make a requery
mcandrey
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Mar 25, 2003 3:59 am
Location: bucharest-romania

Re: populating a combo from database

Postby Xerpher » Tue Mar 25, 2003 10:03 am

buspass wrote:1. Would this be more efficient than hard coding the items in the HTML?

2. How would I prevent the page re- querying the database upon page refresh? In otherwords, once the combo has been populated, there is no need to populate it again.

1. It would be worse, php only compiles the data in to html then sends it, so instead of just sending it, you would have to compile AND send it.

2. PHP doesn't work that way, everytime you compile a page you would have to reload all the information over and over again, hence, another reason this is a terrible idea.

Hope that helps :)
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron