PHP

How To Post Data using PDO in PHP/MySQL

How To Post Data using PDO in PHP/MySQL

Hi, Freinds in this post we are going to learn How To Post Data using PDO in PHP/MySQL. PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases. This means developers can write portable code much easier. PDO is not an abstraction layer like PearDB. PDO is a more like a data access layer which uses a unified API.

How To Post Data using PDO in PHP/MySQL

1-Creating Database

  • Open PHPMyAdmin in your Browser
  • Click on Database Tab Display on Topside
  • Give the Database name “pdo”.
  • After Creating Database Open it.
  • Click on SQL Tab on Top area
  • Copy the Below Source Code and paste it.
  • Then Click on Go.
OR Import DB File

After Downloading the source code extract it in your root folder.

  • Open PHPMyAdmin in your Browser
  • Click on Database Tab Display on Topside
  • Give the Database name “pdo”.
  • After Creating Database Open it.
  • Click on Import Tab on Top area
  • You can Find Database folder in  Downloaded source code where find register.sql file then Select it.
  • Then Click on Go.

Download More Source Code Like

2- Creating Database Connection

After import Database File then next step is creating a database connection using php copy the below code and save it is as “conn.php”.

3 – Creating Index Page

in this step we are creating page layout where you can add user and show all posted data. here the source code. you can copy the below code and save it as index.php.

4 -Post Data using PHP/MySQL with PDO

in this step we are going to post data in PHP into MySQL using PDO. Here the source code you can copy the below code and save it as save_member.php.

If you facing any type of problem with this source code then you can Download the Complete source code in zip Formate by clicking the below button Download Now otherwise you can send Comment.

About the author

Deepak

Hi, This is Deepak Raj from Sourcecodesite.com.I am a Web Developer, Blogger, Online Instructor and SEO consultant who has been working online for last 4 years and he is running several successful websites on the internet.

Leave a Comment