Data storage in PHP

Temporary and permanent containers with few and many data. According to each one of our specific needs, we will have different alternatives to store data in places that we will access from the server, where the PHP interpreter will be able to read them by himself and he will use them for his task of manufacturing an HTML page.

Data storage in PHP | Learn PHP & MySQL | Temporary and permanent containers with few and many data. According to each one of our specific needs, we will have different alternatives to store data in places that we will access from the server, where the PHP interpreter will be able to read them by himself and he will use them for his task of manufacturing an HTML page

Temporary and permanent containers with few and many data

Previously, we told the PHP interpreter what contents to write within each print () or echo order. We also provide each of the data with which he worked and we dictate everything he wrote.

But paradoxically, the utility of PHP lies in delivering different content to a Web browser, depending on how certain events are triggered by the programmer of the page (according to the password entered, the link clicked, a data that is validated, etc.)

This behavior is called dynamic Web pages; that is to say: the browser, after requesting a URL, will receive as a response a Web page that was not written in its entirety by the designer or programmer with its editor program, but its code -all, or at least a part- will write it the PHP interpreter every time a user asks to see that page with their browser; therefore, the page will be built "live" on the server, a few moments before it is sent to the browser.

This leads us to an obvious question: if it is not us (designers, programmers) who will dictate letter by letter to the PHP interpreter, where will you get these data? The answer is "from several possible places".

According to each one of our specific needs, we will have different alternatives to store data in places that we will access from the server, where the PHP interpreter will be able to read them by himself and he will use them for his task of manufacturing an HTML page. Next we will mention some of those possible places -the main ones-, so that we can imagine the resources with which we will work:

The data can be stored in a variable - or in a matrix (created by us, or one of the many matrices in which the PHP interpreter automatically stores information)-

The user will be able to enter the data and, consciously or unconsciously, he will use his browser to send the variables to the server, either through a form or through the variables attached to a URL, with a special type of link. A sending of "signals" to the server that our PHP page will be waiting to decide what information to show.

The data can also be obtained as a result of executing a function (of those that are included in the PHP language, or of the functions that we will create ourselves).

A data can be stored in a cookie that the user's browser will silently save.

You can read a data in a session variable, which will allow us to identify a particular user at a given time.

You can read the data written within a text file (txt, XML, etc.) existing on the server.

You can read the data stored in a database (without doubt, the most powerful option to handle large amounts of data, such as product catalogs, forum messages, etc.).

CONTAINERS

TEMPORARY

PERMANENT (or almost)

Few data

Variables (local, Text files, cookies, sessions forms, URLs), constants, functions.

Text files, cookies, sessions

Many data:

Matrices

Databases

🤖

ChatGPT Free
Ask questions on any topic

CITE ARTICLE


For homework, research, thesis, books, magazines, blogs or academic articles

APA Format Reference:

Delgado, Hugo. (2019).
Data storage in PHP.
Retrieved Apr 25, 2024, from
https://disenowebakus.net/en/data-storage-php

Participates!

Share it with your friends in Social Networks!

Professor at the University of Guadalajara

Hugo Delgado Desarrollador y Diseñador Web en Puerto Vallarta

Professional in Web Development and SEO Positioning for more than 10 continuous years.
We have more than 200 certificates and recognitions in the Academic and Professional trajectory, including diploma certificates certified by Google.

CONTINUE LEARNING

PREVIOUS


IT ALSO DESERVES TO PAY TO VISIT:

Not finding what you need?

Use our internal search to discover more information
Related content:

Would you like to learn more about Web Design?

Meet all the courses and tutorials that we have for you completely free
Learn Web Design
 

Leave your Comment

SPONSOR

Your business can also appear here. More information

Next article:

Your browser has blocked advertising.
Please 🙏 allow to visualize the announcements to be able to access, thank you.