Prevent sql injection in q2a custom php form ?

Post date: 2020-04-01 08:33:04
Views: 133

This is how i store data in mysql via php form. I know its 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 latest php 7 and above version ?
I think escape string is deprecated or outdated.

Thanks for your help !

Please click Here to read the full story.
 
Other Top and Latest Questions:
TurboTax for contractor and non-contractor work in the USA
Trustworthy way to send PDF as a FAX on a Mac?
Hazbin Hotel: Hello Rosie
Tickets for Candidates Tournament
Dog personality changes on prednisone
noise reducing (not cancelling) earplugs (not headphones or earbuds)
Best response to someone presenting a widely shared idea as their own
What do I wear to tai chi? And work.
Turn a poll into a live-updating bracket?
FEUD: Beautiful Babe