I'm trying to insert data from a $_POST into mysql.
Initially I tried
<?php
...
$InsertStatement = "INSERT INTO test VALUES ('$POST[x]', '$POST[y]', '$_POST[z]')";
//this compiles, but does not put values into the test table.
//assume $db connection
$Insertion = $db->query($InsertStatement);
?>
I was extensively warned that I should not use $_POST inline because of potential SQL injection. So I tried to set them to variables and then put them in the SQL statement.
<?php
...
$x = $POST[x];
$y = $POST[y];
$z = $_POST[z];
$InsertStatement = "INSERT INTO test VALUES ('$x, 'y', 'z')";
$Insertion = $db->query($InsertStatement);
?>
This also compiles, but does not insert values into the table :queasy: . As always, any help would be greatly appreciated!