How to Write SQL Queries in Latte?
Latte can also be useful for generating really complex SQL queries.
If the creation of a SQL query contains many conditions and variables, it can be really clearer to write it in Latte. A very simple example:
Using $latte->setContentType()
we tell Latte to treat the content as plain text (not as HTML) and then we
prepare an escaping function that escapes strings directly by the database driver:
The usage would look like this:
This example requires Latte v3.0.5 or higher.