PHP Connect to MySQL
PHP 5 and later can work with a MySQL database using MySQLi and PDO (PHP Data Objects). Both MySQLi and PDO have their own advantages but PDO will work on 12 different database systems, whereas MySQLi will only work with MySQL databases. PDO is object-oriented and support Prepared Statements that protect from SQL injection, and are very important for web application security.
Steps to create CRUD in PHP using PDO
- Create a database and table either manually or directly with any name.
- Create a folder in XAMP and prepare the following php files
- dbconfig
- Insert
- Index – Read
- Update
- Delete