Categories

Thursday, April 25, 2024
#919814419350 therichposts@gmail.com
MysqlPDOPhp

How to make like query in pdo mysql?

make like query in pdo mysql

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

Here is the working like query in pdo mysql and you can do like this query:

<?php
//You can define variable like this
$datetime = $datetime.”%”;
//I am using joins also in  this query

$QUERY = $DBH->prepare(“SELECT A.*,
C.objectId AS ’empId’, C.name AS ’empName’, E.name AS ‘placeSubServiceName’,
D.objectId AS ‘customerId’, D.firstName, D.lastName, E.cost, E.duration FROM booking A
JOIN employee C ON C.objectId = A.employeeId
JOIN user D ON D.objectId = A.userId
JOIN placesubservice E ON E.objectId = A.placeSubServiceId
WHERE A.placeId = $PLACE_ID AND A.employeeId in($STAFF_ID) AND
//Here you can use like statement like this
A.startDateTime LIKE ‘”.$datetime.”‘ AND A.status = 1 ORDER BY DATE(A.startDateTime) ASC”);
$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.