Bad where clause construction
Closed this issue · 1 comments
Brewal commented
ltrim
should not be used here. ltrim
removes any of the characters in the second parameter starting from left until it encounters another character.
So if you have a field starting with capital 'A', 'N' or 'D', this first char will be removed.
preg_replace
should be used instead to remove the first ' AND '
:
return ' WHERE ' . preg_replace('/^(\sAND\s)/', '', implode('', $args));