PHP PDO CRUD with Ajax jQuery and Bootstrap
PHP CRUD APPLICATION USING AJAX |
In this tutorial we’ll be creating a complete Create, Read, Update, and Delete application with PHP, PDO, and MySQL using jQuery Ajax and Bootstrap. We’ll be creating the app completely from scratch, no additional frameworks required.
A CRUD app is often used in conjunction with a database, interacting with records in a table. We’ll be using MySQL as our database management system in our app.
We’ll create a database with a players table, we’ll be able to manipulate these players in our CRUD application, the players table will contain name, emails, phone numbers and profile photo.
Requirements
- Web Server — I recommend you download and install XAMPP on your local computer system, this server package includes MySQL, PHP, phpMyAdmin, and the PDO extension.
- PHP — I recommend you use the latest version of PHP, but older versions should work just fine (skip if you installed XAMPP).
- PDO Extension — Should be enabled by default if you’re using XAMPP, but if it’s not you’ll need to enable/install it.
Creating the Database and setting-up Tables
The MySQL database we’ll use to store players and retrieve them with PHP. If you’re using XAMPP follow the below instructions.
- Navigate to http://localhost/phpmyadmin/
- Click Databases at the top
- Under Create database input playersdb and select utf8_general_ci as the collation
- Click Create
- Select the newly created database
- Click the SQL tab and execute the below SQL:
CREATE TABLE `players` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pname` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`phone` varchar
atOptions = {
'key' : '663539eb42566050ce55e91706150bca',
'format' : 'iframe',
'height' : 300,
'width' : 160,
'params' : {}
};
document.write(' ');
The above SQL will create the table: players, we’ll be using this table in our app.
There are 6 columns in the players table (id, pname, email, phone, photo, and status).
In phpMyAdmin, the database should look like the following:
Comments
Post a Comment