3

I am having a problem creating a query in PHP to retrieve a json value from a postgresql database.

The problem is within the json WHERE clause of the following simple query

select * from json_data where jsonfield ? 'roottag';

if i use the PDO prepare:

$query->prepare($sqlSelect);

PDO will translate the ? (postgres json operator to see if the json field starts with a specific tag) to $1.

How do i write a sql statement similar to the one above to be used within php PDO?

2
  • How about read the docs first? php.net/manual/en/pdo.prepare.php Commented Jan 27, 2017 at 18:07
  • @FelippeDuarte Apologies, i did read that page, but have not understand how to avoid that prepare() translates the "?" Commented Jan 27, 2017 at 18:15

1 Answer 1

2

To safe other people some time: A PATCH IS ON THE WAY! (at the time of writing)

see: https://github.com/php/php-src/pull/1967

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.