abdfahim
Well-known member
When I need to use raw SQL, what is the correct approach to avoid SQL injection? For example, when
assuming the query is too complex to use Finder object.
$userinput
is a GET parameter (hence any end user can set it to anything), is the below query safe?
Code:
$db = \XF::db();
$db->fetchAllKeyed("SELECT ..........................
HAVING column_expr LIKE ?", "user_id", $userinput);
assuming the query is too complex to use Finder object.