PHP – PDO Insert data into database using OOP Concept

I am using PDO – OOP concept for inserting data into database . If you are new to pdo then please learn basics of pdo . I have used simple OOP concept only class for connection and function for executing pdo query .

This is table in db & coulmn names are : id , name , age & email

idnameageemail
1bobby39b1@gmail.com
2harsh33h1@gmail.com
3nimesj23n1@gmail.com
4aftab12a1@gmail.com

Please make same table as i have made for you dont change column names otherwise you will get errors & if you want different names then you have to change all coulmn names in php code .

Now if you will run this code in your browser then your output will be this

idnameageemail
1bobby39b1@gmail.com
2harsh33h1@gmail.com
3nimesj23n1@gmail.com
4aftab12a1@gmail.com
5Robert Venda31dys@gmail.com

Please dont use mysql now start using mysqli or pdo

Leave a Reply

Your email address will not be published. Required fields are marked *