Re: Which is faster, a MySQL access, or a set of PHP variables?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 10:32 AM 12/30/2005, Dave M G wrote:

PHP General,

        I have a site where I will set the interface up to be multilingual.
This means that all the snippets of text which make up the menu and
other elements of navigation common to most pages will be stored as
variables.

        In most web site set ups that I have seen, especially on forums, the
text is stored in a PHP script which is just a long list of variables.

        I wondered if there was any downside to storing the list of interface
texts in a MySQL database, then calling them as an array when the page
loads?

        This would have one minor advantage, which is that as I expand to new
languages, I could build a simple web interface where people could input
new languages into a form.

        However, is it a drag on a server to have to reach into the MySQL
database to retrieve the array of texts each time the page loads? Note
that the texts will be something like 20 to 30 small one to four word
phrases like "contact" and "previous page" and that sort of thing.

On the surface, it doesn't seem like this would be much different than
accessing a PHP script with a list of variables. But then, I figured
there might be a reason why I've never seen it done this way.

        Opinions would be much appreciated.

--
Dave M G

Dave,

I did that for an online auction site, now defunct, where the languages could be German or English. To expand to Spanish one had only to supply the structure and have someone who knew one of the other languages to enter the correct terms. That would be pasted into the script and run, presto, the site was available in Spanish.

Database hits ere not a problem, as all of the content on the page came from a database, none of the content was static.

That was three years ago, and it was done that way because native language support was "wobbly" in both PHP and Apache.

Joachem's solution is probably better for today.

Cheers - Miles Thompson

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.371 / Virus Database: 267.14.9/216 - Release Date: 12/29/2005

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux