heminei / php-query-builder

Powerfull and lightweight PHP SQL Query Builder with fluid interface SQL syntax unsing bindings and complicated query generation
MIT License
10 stars 2 forks source link

where condition generates some kind of id #3

Closed kwyntes closed 3 years ago

kwyntes commented 3 years ago

I'm using this code to add a where condition:

$query->where('users.id', 10);

And the output is:

WHERE users.id=:6e95496c414eb3756a2a19646b70c8fe830d3d28

Each time I run this code the string is different, for example:

WHERE users.id=:2060e4f5268a8401be042e403b36cb4cc0034f11

This makes the entire library pretty much unusable.

heminei commented 3 years ago

The query builder use bind parameters. The hash is a unique parameter name. Method "getQueryString" is for debugging only. What do you want to do?

kwyntes commented 3 years ago

Ah, I didn't know getQueryString was for debugging only. What is the correct method for getting the raw SQL string?

heminei commented 3 years ago

You can't get real SQL with the PDO driver. You can get similar query with "getQueryString(true)" but only for debugging. If you want to fetch data use [https://github.com/heminei/php-query-builder#fetching-data](this methods)

kwyntes commented 3 years ago

Ah okay thank you!