#Binding index 1 when only 1 parameters are expected

1 messages · Page 1 of 1 (latest)

mild moat
#

I am trying to write a query which allows filtering using the search box. but I am getting the error

Binding index 1 when only 1 parameters are expected

The query works fine when entered such as:

SELECT * FROM lead
WHERE status != 'Dead' AND status != 'Converted'
ORDER BY account_name
limit 20 offset {{ (LeadTable.pageNo - 1) * 20 }};

But when I add WHERE account_name like '%{{LeadTable.searchText}}%' I get the error like the query below.

SELECT * FROM lead
WHERE account_name like '%{{LeadTable.searchText}}%' AND status != 'Dead' AND status != 'Converted'
OR name like '%{{LeadTable.searchText}}%' AND status != 'Dead' AND status != 'Converted'
ORDER BY account_name
limit 20 offset {{ (LeadTable.pageNo - 1) * 20 }};

hollow mantleBOT
#

Hey! Can you send a screenshot of the error in the console as well as the
evaluated value of the query?

mild moat
#

@hollow mantle there is no evaluated result as execution fails

hollow mantleBOT
#

Can you try turning off Use Prepared Statements and re-running? You may have to
add single quotes around your bindings that are meant to be strings.

mild moat
#

@hollow mantle Sorry, I was getting stressed out with this yesterday. totally forgot about the prepared statement selection. my bad

hollow mantleBOT
#

Is the issue resolved now?

mild moat
#

Yes