I found this strange behaviour when solving issues with some module.

The following query will fail:

dbquery('SELECT * FROM table1 WHERE table1.field1 = :param1 AND table1.field2 = :param1', array(':param1' => 'sample'));

while this will work:

dbquery('SELECT * FROM table1 WHERE table1.field1 = :param1 AND table1.field2 = :param2', array(':param1' => 'sample',':param2' => 'sample'));

It looks as though you cannot re-use a parameter more than once in a query. ¿Is this correct?

Comments

omegamonk’s picture

Status: Active » Closed (duplicate)

@david_garcia_garcia:

I validated this while working on another issue this past Friday. I am working on a resolution now. I am going to close your issue as a duplicate of that issue (https://drupal.org/node/1598924)