I'm currently developing a website that will be deployed once it is finished so i'm concerned about the security of my website.
I learned that $_GET can be used by attacker to do UNION and LOAD_FILE attack, as normally people will use .php?catId=1 to fetch data and show it on the page.
However i was wondering if by using the name instead like .php?catName=product_1 will help to protect from the attack as the query to fetch the data will become like this :
$sql = "SELECT * FROM category_table WHERE category_name = '" . $_GET['catName'] . "'";
As now the value is a string, a single quote (') is needed for the query to work where before it is not needed as id is integer.
This single quote is able to block the UNION query but im not sure if this is enough