I want to prevent SQL injection in Question2Answer.
This is how I store data in MySQL via HTML form. I know it's a security risk.
Examples -
$price = $_POST['price'];
OR
$price = array_key_exists('price', $_POST) ? $_POST['price'] : "";
and SQL query is -
$insertqry = qa_db_query_sub("INSERT INTO test_table (title, price) VALUES ('$title','$price')");
How should I post data in the latest PHP 7 and above version?
I think escaping strings is deprecated or outdated.