A brief story: In one of my early professional projects (a little over a decade ago), I had to migrate a PHP application to a newer version of MySQL. During the process, I realized the importance of using updated and secure extensions for database communication. That’s when I delved into using MySQLi, understanding its advantages and best practices. This repository aims to share that knowledge by providing practical examples of how to establish efficient and secure connections to MySQL databases using the MySQLi extension in PHP.
01-connecting-to-the-database.php
: Demonstrates how to establish a basic connection to the database using MySQLi.02-executing-commands-in-the-database.php
: Provides examples of executing SQL commands in the database.03-listing-database-data.php
: Shows how to retrieve and display data stored in the database.04-sql-injection.php
: Highlights the risks of SQL Injection and how to prevent them.05-prepared-statement.php
: Introduces the use of prepared statements to enhance query security.06-connection.php
to10-connection.php
: Contains more advanced examples of CRUD operations (Create, Read, Update, Delete) using MySQLi.
-
Clone the repository:
git clone https://github.com/antonio-phpfullstack/mysqli-connection.git
-
Environment Setup:
This project is based on the following repository:
If you do not have PHP installed on your host or wish to replicate the developer's environment, clone the repository above and place the PHP - MySQLi Connections repository inside the www/public
directory.
- Running the Examples:
Each PHP file in the repository contains independent examples. It is recommended to run them individually to understand how each operation works.
This repository aims to provide a solid foundation for developers who want to improve their skills in PHP and MySQLi. Remember, consistent practice and continuous learning are essential for professional growth. Good luck!
- 🎉 Website: https://phpfullstack.com.br