0

My search function returns the correct results when I am using for example q=Cambri but when I try to search using for instance q=021 nothing is returned. In my database I have set postal_code field to be of type text and place_name field to be of type text also. Below is the python code for selecting element from the database:

"SELECT * FROM places WHERE ((postal_code LIKE :postal) OR (place_name LIKE :postal))"
1
  • With the limited code provided this is a guess only but it looks like your query is only filtering from :postal. Maybe it should be something like: "SELECT * FROM places WHERE ((postal_code LIKE :CHECK_THIS) OR (place_name LIKE :CHECK_THIS))"
    – PXSOCS
    Aug 18 '18 at 22:30
0

You need to concatenate a % to the end of q

Without seeing more of the code your search route its only a guess

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .