loading info dynamically into HTML select fields

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
yellowlabrat
Forum Newbie
Posts: 1
Joined: Sun Jan 03, 2010 7:26 am

loading info dynamically into HTML select fields

Post by yellowlabrat »

Hello all,

I am developing a website in PHP and have multiple "dynamic" dropdown fields that are used throughout the website.
For example, a user may visit a page that has about 15 individual calls to the mySQL database.
Each of these calls pulls information from various tables into an HTML select field.

I have the page pulling information dynamically into the select fields so that their content can be managed in an "admin" portion of the website.

So, my question is:
Is this the best way to do this? Every time the user loads the page, pull that info in dynamically?
Because it could be changed by an admin at any given moment.
Or.... should I load all the information into session variables the first time the user logs in or loads that page? That could help with database load. I'm not even sure the database is being taxed that hard, I'm just worried that it would get that way with a lot of users.

Currently, there's less than 100 simultaneous users.

Thanks for any help you can offer,
George
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: loading info dynamically into HTML select fields

Post by alex.barylski »

Typically you pull on the DB each invocation and populate the drop down. If real time is *that* important:

1. Reconsider building on the web
2. Consider using AJAX to update the drop down at set intervals (every 5 secs)

Cheers,
Alex
Post Reply