Bruce Gust
asked on
Is there an elegant way to view sql statements written in PDO?
Here's my query:
$sql=$con->prepare("Select registrationeventid from tblregistrationeventtoscre ening where screeningperiodid in (select screeningperiodid from tblscreeningsubperiod where screeningsubperiodid =:screeningsubperiodid)");
$sql->bindValue(':screenin gsubperiod id', $screeningsubperiodid, PDO::PARAM_INT);
$sql->execute();
I want to "echo" it so I can be certain I've written a good query. In the past, I would use "echo." How can I pull the same thing off in PDO?
Based on what I've seen thus far, you can't. But I'd like to think there's a ninja out there who's figured something out.
Thanks!
$sql=$con->prepare("Select
$sql->bindValue(':screenin
$sql->execute();
I want to "echo" it so I can be certain I've written a good query. In the past, I would use "echo." How can I pull the same thing off in PDO?
Based on what I've seen thus far, you can't. But I'd like to think there's a ninja out there who's figured something out.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Open in new window
I do something like this: $check_query=self::debug_s
..and it gives me this:
function name:reggie_id
SQL: [194] Select registrationeventid from tblregistrationeventtoscre
Params: 1
Key: Name: [21] :screeningsubperiodid
paramno=0
name=[21] ":screeningsubperiodid"
is_param=1
param_type=1
Not sure what some of those parameters mean, though. I've got another question that deals with that and would appreciate your input:
https://www.experts-exchange.com/questions/29004689/What-do-the-parameters-in-the-PDO-function-debugDumpParams-mean.html
Thanks!
Not bad.