I googled it, but it's so much information over there. So, I've go the following query:
$name = (string) $_GET['user-input'];
if (str_contains('`'))
throw \Exception('Error message');
$sql = "SELECT * FROM users WHERE `$name` = 'someUsername'";
// ... query execution comes here
My question is: is It enough (safe) to enclose column names with the "`" character?
I don't want to use regExp
because I think it has the worst effect on performance.
If I can't use just "`", what should I do then?