For php, mysql extracts from the database and saves it to a php file-php Tutorial

Source: Internet
Author: User
For php, mysql extracts and saves data from a database to a php file. for example

For the forum, there should be two basic values for each forum table
1. fid
2. name

However, if there are too many people, I don't want to view the fid every time I see it.

Can it be made after this table is changed or after an action is performed?

It will be queried from the database once, and then saved to a php file (as cache), saved as an array

Every time a user browses, fid is pre-configured in the template to find the cached php file and relevant information in the array.


How can this be done?


Reply to discussion (solution)

The program file is a file, and the table is also a file
All of them are in the file. why do I have to do it multiple times?

If not? But directly? Query the result ??? Faster than querying files.

If the memory is large enough, it can be stored in the memory.

Cache with memcache

Without memcache, I only use SMARTY
Do you think it is faster to directly use mysql?

If the forum cannot be changed once a year, I directly create an array and put it in the configuration file. this is better than Querying SQL
Which one is relatively low?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.