--- Luis Lebron <[EMAIL PROTECTED]> wrote:
I am rebuilding a php application to handle a higher load. The
 previous programmer had created a series of dynamically generated
 select boxes using a mysql table. Would it be faster or less
 resource intensive to create a series of arrays to generate the
 select boxes and avoid the database queries. I've done some informal
 testing using Pear Benchmark and it seems the array based script
 usually takes less time.

--- Chris Shiflett wrote:
>>Basically, anything you can do to eliminate talking to the database will
>>usually improve performance by a fair margin. The downside is convenience;
if
>>you have data hard-coded in your PHP scripts, it is less convenient to
maintain
>>the data. You effectively eliminate the separation between the data and
your
>>logic.

>>A similar idea is to eliminate PHP. Apache can serve a lot more static
pages
>>than it can PHP pages at any given time. Of course, this has a similar
>>disadvantage as well. Now your pages are static rather than dynamic.


I figured that writing the select boxes as plain html would be the fastest
solution. However, I did not know of a way of repeating back the database
contents using plain html. Now I can compare the the array with the database
information and show the previously selected element in the select box. 

The data is fairly static (i.e. states, countries, etc) so I just created an
include file with the arrays and include it as needed.

Thanks for the feedback.


Luis

Reply via email to