Contenu du cours
Module 1 — Discovering PHP
Understand what PHP is, set up a local environment and write your first script.
0/4
Module 3 — Functions, arrays and forms
Create functions, work with arrays and handle data coming from a form.
0/4
PHP for beginners

A database stores your information permanently: users, articles, orders and so on. PHP most often talks to MySQL.

The basic vocabulary

  • Database: the big container.
  • Table: a grid of data (e.g. users).
  • Column: a field (e.g. name, email).
  • Row: a single record (one specific user).

Talking to it from PHP

You use the modern PDO extension (or mysqli). The main steps:

  1. Connect to the database with the host, the name, the user and the password.
  2. Write an SQL query, for example SELECT * FROM users.
  3. Run the query and loop through the results.

The query language is called SQL: SELECT to read, INSERT to add, UPDATE to change, DELETE to remove.

Key point: a database holds tables, made of columns and rows. PHP connects to it through PDO and communicates in SQL.

Prix indicatifs, convertis depuis l'euro