1. Create the database
To manipulate data, we need a database. In this tutorial, we’ll be using XAMPP as our web server. XAMPP provides an environment for PHP and comes built-in with MySQL database, making it perfect for our needs. After you have installed XAMPP, run the program by clicking on its icon. You should see a screen like the following. If they have not been started already, click the start buttons next to Apache and MySQL respectively. Do not start the other services.
- Open phpmyadmin ( http://localhost/phpmyadmin/)
- Click on the “New” link in the left sidebar to be taken to a form where you can name and create the database.
- Enter the name “contact_manager” for the “Database name” then click the “Create” button.
CREATE TABLE contacts ( id int PRIMARY KEY AUTO_INCREMENT, name varchar(255), email varchar(255), phone varchar(255), notes varchar(255) );
After running this command, you can check the structure tab of the “contacts” table to confirm that it was created successfully.