Categories

Friday, April 19, 2024
#919814419350 therichposts@gmail.com
MysqlPDOPhp

Insert query example in mysql using pdo

Insert query example in mysql using pdo

Hello to all, welcome to therichpost.com. In this post, I will tell you, How to Insert data in mysql using pdo? PDO means PHP Data Object. PDO is more secure and it is opps based.

Here is the example code for Insert query example in mysql using pdo:

To connect with mysql with pdo, you can check this link: How to connect mysql database using pdo?

$QUERY = $DBH->prepare(“INSERT INTO role(placeId, name, staff, roles, services, offers, profile, offerService) VALUES (:placeId, :name, :staff, :roles, :services, :offers, :profile, :offerService)”);
$QUERY->bindParam(“placeId”, $PLACE_ID,PDO::PARAM_STR);
$QUERY->bindParam(“name”, $ROLE_NAME,PDO::PARAM_STR);
$QUERY->bindParam(“staff”, $STAFF,PDO::PARAM_STR);
$QUERY->bindParam(“roles”, $ROLES,PDO::PARAM_STR);
$QUERY->bindParam(“services”, $SERVICES,PDO::PARAM_STR);
$QUERY->bindParam(“offers”, $OFFERS,PDO::PARAM_STR);
$QUERY->bindParam(“profile”, $PROFILE,PDO::PARAM_STR);
$QUERY->bindParam(“offerService”, $OFFER_SERVICE,PDO::PARAM_STR);
$QUERY->execute();

There are so many tricky code in PDO and I will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.