What is wrong with this query : " SELECT * FROM table WHERE id = $_POST[ 'id' ]"?
What is wrong with this query: "SELECT * FROM table WHERE id = $_POST[ 'id' ]"? Erick Wilsom 2354 27 Oct 2022 What is wrong with this query: "SELECT * FROM table WHERE id = $_POST[ 'id' ]"?
The use of table keyword it displays error when we execute the query SELECT * FROM table WHERE id = $_POST[ 'id' ]'?
Never use user input directly in queries.
This works:
$_POST['id'] = 27;
$sql = 'SELECT * FROM table WHERE id = $_POST[ 'id' ]'; echo $sql;
l = 'SELECT * FROM table WHERE id = $_POST[ 'id' ]';
echo $sql;