How to insert data into MySql using PHP

In this tutorial i will explain how to insert data into MySql using PHP.
[aio_button align=”none” animation=”none” color=”red” size=”small” icon=”play” text=”View Demo” target=”_blank” relationship=”dofollow” url=””]

First Create a database with name demo. Now create a table with name data.

Here the strcuture of table

Code for mysql connection with php

Create a HTML Form for user inputs

Now get user inputs and store in the PHP variables

Query for insert data into mysql using PHP

Full PHP Script for insert data into database using mysql

Here is the full code that we have written during this tutorial:

View Demo

Download Source Code(How to insert data into MySql using PHP)
Size: 27.8 KB
Version: V 2.0

About the author

Anuj kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.

Leave a Comment

1 Comment

Subscribe For Latest Updates