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 8375855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:17:02+00:00 2026-06-09T15:17:02+00:00

Lets say I’ve got 50 pages, and I want to write a description for

  • 0

Lets say I’ve got 50 pages, and I want to write a description for about 30 of them.

The description will be about two paragraphs on each page.

Is it more efficient for my server if I save the descriptions in a MySQL database and then query on each page to see if there is a corresponding description, or is it best if I store them in an array in my PHP file and see if the element exists?

Extra Info:
I would edit the array file manually or the db entry through phpMyAdmin which would both take the same amount of time. Also it would only be me editing them so I don’t have to worry about making a quick edit file.

  • 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-09T15:17:03+00:00Added an answer on June 9, 2026 at 3:17 pm

    Do it like this:

    Store them in an array, in a sepparate file data.php, in this form:

    <?php
    return array(
      // here be data
    );
    

    In the caller script you use it like this:

    $data = require 'data.php';
    

    and then use the $data variable throughout the site, as needed. You could also split the array and use several files based on specific criterias, like “the language”, or “article category” or whatever.

    If you do it this way, you can always plug in an editor with a web interface to edit that array and store it back with file_put_contents('data.php', '<?php return '. var_export($data));, where $data has got its value after processing a POST form, for instance, which was generated from the old value of $data.

    Really elegant, fast, and maintainable!

    As a bonus, write helper functions around those serializations, deserializations, etc, such that if you ever change your mind (because your site grows and you end up with hundreds of such arrays), you only have to reimplement those functions to use a database backend, without ever touching the rest of the codebase.

    Code reusability and maintanability at its peak! And you get it up and running immediately, without losing the prospect of making it better in the future, if required.

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

Sidebar

Related Questions

Lets say I've got two interchangeable pieces of code and I want to figure
Lets say i have at least two lua script files. test1.lua test2.lua both define
Lets say that i have 2 pages: index.php and service.php index.php sends an http-post
Lets say that I have 4 view controllers (call them FirstView,SecondView,ThirdView,FourthView) which are created
Lets say in a file I have some code in two files part of
Lets say you have two classes, Boss and Employee. There is a bidirectional many-to-many
Lets say that I have several DevExpress controls and one of them is a
Lets say we've got a Grid with with 30 columns and 30 rows. Rules
Lets say I have an image or two dimensional pattern similar to QRcode and
lets say i have two branches master develop in master i have something like

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.