PHP PDO : insert, update delete example for beginners
Creating a web application using PHP (Hyper Text Preprocessor) and PDO (PHP Data Object). Here in this article I am exploring the latest feature of PHP to do better deal with databases. Yes, it’s PDO. After the many feature of MySQL function are improved or depreciated the MySQLi (MySQL improved) introduce. Still MySQLi is doing well but problem is you can connect to only one database using it that is MySQL. To improvise the better database connectivity option for most popular web server side scripting language PHP. PHP introduce PHP data object (PDO). So, Question is -,
What is this PDO?
PDO is PHP data object which provide the data access layer. PDO have uniform and most powerful API methods to access multiple web databases using PHP.
PDO have many benefit as compare to MySQL and MySQLi.
- PDO can connect 12+ popular database product.
- It have all the feature of MySQL functions.
- It is free from SQL injection.
- It is safe and robust.
- It is fast in execution.
- It is portable. No need to rewrite code on database product change
- It provide extreme use of Object Oriented Programming (OOP).
- It support database transections in PHP.
Let’s Experience the power and beauty of PDO using a simple example.
I have targeted this example to PHP and PDO beginners. In this example I am going to explore a web application which do insert, update, delete, search and display operations using PDO in PHP on MySQL database. Here I have used the prepared statement to do insert, update, delete, search and display records in MySQL database.
I have try to keep my code as simple as possible so even beginners can also understand the example. I have organized PHP code in such a way that can be the stat up of any new simple PHP project. I have try to keep separate HTML and PHP portion as much possible.
This example is divided in multiple part.
Part-1: Configure and Setup the MySQL database connection using PDO.
Part-2: Create a MySQL Database and a table using PDO.
Part-3: Insert record using prepared statement in PDO.
Part-4: Display Records using prepared statement.
Part-5: Search records using AJAX and PDO in PHP.
Part-6: Update Record using prepared statement in PDO.
Part-7: Delete Record using prepared statement in PDO.
Subscribe to:
Post Comments (Atom)
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- c (11)
- Configure Tomcat7 (2)
- CSS (3)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- install Tomcat (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- linux (8)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- shell script (33)
- unix (22)
- WTAD (34)
Blog Archive
-
▼
2015
(13)
-
▼
July
(8)
- PHP-Delete Record using prepared statement in PDO
- PHP - Update Record using prepared statement in PDO
- PHP - Search records using AJAX and PDO
- Part-4: Display Records using prepared statement
- PHP insert update, delete using PDO part-3
- PHP insert update, delete using PDO part-2
- PHP insert update, delete using PDO part-1
- PHP PDO : insert, update delete example for beginners
-
▼
July
(8)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.
1 comments:
Hi. Great code.
Is this example free from SQL injection?
Best
Post a Comment