Previously, we looked at how to read data from a MySQL database, using PDO. So, how do you add records and update them?
Let’s start with how to add a record …
Step #1: You need to define set up your PHP file
PHP is executed out of files that end in ‘.php’ (as you might expect). You also need to define where, in the file, your PHP code is. That’s done by prepending your code with ‘<?php’ and appending it with ‘?>’. Let’s see what that looks like.