php-reports icon indicating copy to clipboard operation
php-reports copied to clipboard

Passing "&" in a filter

Open belay-anthony opened this issue 10 years ago • 0 comments

The name I want to filter by is: Tom & Jerry

My code looks like this: -- VARIABLE: { -- name: "ctoon", -- display: "Filter by Cartoon Name", -- type: "select", -- database_options: { "table": "cartoons", "column": "cartoon_name", "all": "true", "where": "1 ORDER BY cartoon_name ASC" } -- }

WHERE (cartoon_name = "{{ctoon}}" OR "{{ctoon}}" = "ALL")

The problem is, I don't get any results even though the name was populated in the filter as an option. When I look at the SHOW QUERY at the bottom of the page the code tried to send this statement

AND (cartoon_name = "Tom & Jerry" OR "Tom & Jerry" = "ALL"

How do I get the filter to pass in the data correctly?

If I use a name that has an apostrophe, I get a similar error but with this:

\'

where the apostrophe should have been.

What I am really asking, is where/how do I decode the HTML back to the correct text so the results are displayed

belay-anthony avatar Aug 21 '15 00:08 belay-anthony