I know this question is sort of dumb but I can't find out where the problem is I checked it with the codes in documentation and similar codes in stackoverflow but I can't figure out the problem. this is my code:
 if (isset($_POST['buy'])) {
 $id = (int) $_POST['id'];
 $name = $_POST['name'];
 $price = (int) $_POST['price'];
 date_default_timezone_set("Europe/London");
 $date = date("Y-m-d h:i:sa");
 $insquery = "INSERT INTO `purchases`  (file_id,     file_name, price, date) VALUES ({$id}, '{$name}', {$price}, {$date})";
 $insResult = mysqli_query($con, $insquery);
 if ($insResult) {
    //do sth
 } else {
     //do sth else
 }
I have tested these: 1- the post array is not empty and returns exactly those that I assigned to variables. 2- I have a table called purchases and it configured properly because I insert data in SQL and get it back successfully. 3- I have tried on SQL statement without {} around SQL variables but no luck.
and another question is after the SQL statement done how can I use the OUTPUT Inserted.ID as a variable in PHP?
thanks in advance.
 
     
    