|Syntactic Confectionery Delight|
Formatting a DBI/MySQL query from HTML form via Perlby Polyglot (Pilgrim)
|on May 21, 2009 at 16:09 UTC||Need Help??|
Polyglot has asked for the
wisdom of the Perl Monks concerning the following question:
I have been wrestling with this for some time now. I have a form which accepts user input for search terms and for a specific resource (MySQL table) in which to search. Is there a good resource for converting "standard" search terms and operators into a MySQL select query? Barring that, I've come up with a rather complicated regexp solution, but it still fails of working intuitively as it should, especially with the following exceptional searches:
Currently, each of these exceptions will return either no results (MySQL error), or an improper result set due to an incorrect ordering of terms.
I'm sure someone must have dealt with this before...
Thank you for sharing your tips with us.