PDO Print Query

Hi folks,

i am new to PDO and did not find an easy way to print the query after much reading.

debugDumpParams()

it gives me some out put but i don’t understand the out put format.

SQL: [149] SELECT count(brand_name) FROM brands WHERE client_id=':client_id' AND subsidiary_id=':subsidiary_id' AND brand_name=':brand_name' Params: 3 Key: Name: [10] :client_id paramno=-1 name=[10] ":client_id" is_param=1 param_type=2 Key: Name: [14] :subsidiary_id paramno=-1 name=[14] ":subsidiary_id" is_param=1 param_type=2 Key: Name: [11] :brand_name paramno=-1 name=[11] ":brand_name" is_param=1 param_type=2 

Any easy wa to print the query?

PDOStatement::$queryString

I created a plug-in for PDO that allows you to view the query with the parameters substituted (and properly escaped) for the placeholders in the query string. If this is what you’re looking for, have a look at it on github:

Thanks guy, ill check your suggestions.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.