RE: [PHP] Performance of dynamically generated select boxes

From: Luis Lebron (llebron_at_sigmatech.com)
Date: 10/30/03

  • Next message: - Edwin -: "Re: [PHP] Japanese entry into MySQL and into emails"
    To: "Php-General (E-mail)" <php-general@lists.php.net>
    Date: Thu, 30 Oct 2003 08:08:10 -0600
    
    

    --- Luis Lebron <llebron@sigmatech.com> 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


  • Next message: - Edwin -: "Re: [PHP] Japanese entry into MySQL and into emails"

    Relevant Pages

    • Re: Collecting choices from several selection boxes and storing them
      ... > favourite books and store them in the database at a table called preferences ... PHP allows you to treat form fields as arrays if you give them the ... I particularly love arrays. ...
      (comp.lang.php)
    • Re: Sample web application
      ... that I'm positively surprised that you use arrays for the ... This seems the best solution to me as well with PHP, ... Jochen Daum - CANS Ltd. ... database editing interfaces. ...
      (comp.lang.php)
    • Re: access 2003
      ... I removed the parameters from the form query source. ... boxes from the form header, events, code, etc and ran the form query source ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would be ...
      (microsoft.public.access.conversion)
    • Re: access 2003
      ... I removed the parameters from the form query source. ... synchronize combo boxes to the detail section or the parameter form query ... forms queries and the SQL because syntax of the SQL will change randomly. ... the Access 97 database, I wouldn't have thought any expressions would ...
      (microsoft.public.access.conversion)
    • Re: access 2003
      ... I would focus on the queries behind the combo boxes. ... the Access 97 database, I wouldn't have thought any expressions would be ... When you select a customer and a job in the two combo boxes, ...
      (microsoft.public.access.conversion)