Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7716265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:35:34+00:00 2026-06-01T02:35:34+00:00

how are you guys? I’m trying to make my PHP script accept many languages,

  • 0

how are you guys? I’m trying to make my PHP script accept many languages, and give the admin the option of change the Phrases in the script.

So, I found that many people store the Phrases in the database, but my question is do I need to SELECT all the phrases from my database each time I opened a page ? or what I have to do?

        Phrase                      EN                          FR
        -----------------------------------------------------------------------
        err_no_page         There was an error.         il y avait une erreur.

in each page I need to use maybe phrases, what is the perfect method to get them from the database without exhausting the server.

Thank’s in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:35:36+00:00Added an answer on June 1, 2026 at 2:35 am

    You should normalize your database like this:

    PHRASES

    ID    DESCRIPTION
    ----  ----------------
    1     'err_no_page'
    2     'another phrase'
    

    TRANSLATIONS

    ID    PHRASE_ID  LANGUAGE_ID  TRANSLATION
    --    ---------  -----------  -------------------------
    1     1          'en'         'There was an error.'
    2     1          'fr'         'il y avait une erreur.'
    3     2          'en'         'etc'
    

    Then you can just select all the translations for a single language directly:

    SELECT
        p.description, t.translation
    FROM 
        phrases p
        INNER JOIN translations t ON t.phrase_id = p.id
    WHERE
        t.language_id = 'en'
    

    The benefit of doing it this way is that you can easily add more languages without changing the structure of your database.

    If these phrases are used frequently (as they probably are in a web app) then you should consider reading them in once into some kind of in-memory dictionary cache when your application starts up, rather than retrieving them from the database for each page load.

    EDIT

    Check out the PHP module memcache for a possible way to implement your cache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guys, can someone give me a brief run through of how to change the
Guys, this can't be for real I'm trying to make a .NET 2.0 executable
guys, I am trying to make use of glVertexAttribDivisor in my OpenGL instanced drawing.
guys, I want to set actions to touches. If people make single touch -
Guys, I'm trying to write xpath or css to find/click on list element All
guys, I'm trying to realize viewing comments on internet portal and I'm using UITableView.
guys i got a php file that use it as xml for a flash
Guys I have been trying lots of different options from cutting up to building
guys. I'm pretty new to both Silverlight and WCF. What I'm trying to do
Guys im trying to check/uncheck a checkbox based on the state check/uncheck of another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.