PHP CRUD Create, edit, update and delete posts with MySQL database

PHP CRUD Create, edit, update and delete posts with MySQL database. Creating, editing, updating and deleting content on a website is what makes the site dynamic.

PHP CRUD Create, edit, update and delete posts with MySQL database

The content that is created, edited, updated, and deleted on a website is what makes it dynamic. In this post, we will carry out that action. 

Before you start reading this post you should have a basic idea about PHP.

Our website will allow visitors to create posts, store them in a MySQL database, retrieve them from the database, and display them on the page. The user will be able to edit and delete each post by clicking edit or delete button on each post.

First, let us create a database with the name crud. In this database, let us create a table called info. The info table should have the following columns:

  • id - int(11)

  • name - varchar(100)

  • address - varchar(100)

Yes, we will be using only two fields here. I'm trying to keep things simple here. so, move on to the next step.

 

Create a file called index.php and copy & paste in it the following code:




	CRUD: CReate, Update, Delete PHP MySQL


			Name
			
		
			Address
			
		
			Save
		
	

If you save and open the site on your browser, you get something like this:

                              

it doesn't look like the best form in the world, right? Let's fix that. copy this below line to your file, directly below the

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow