I'm pretty new to programming with PHP 5.5 and i tried to execute this piece of code but it retrieves me the following error message:
Parse error: syntax error, unexpected 'INSERT' (T_STRING) in "servername" on line 9
My code should get the three values username, order and date, insert them into my database and output a short success message. Here is my code:
<?php
require "conn.php";
$username = $_POST["user"];
$order = $_POST["order"];
$date = date(d m Y - H:i:s,strtotime($string));
$time = $_POST[$date];
$mysql_qry = "INSERT into Orders (Username, Drinkname, Date) values ($username, $order, $date)";
$result = mysqli_query($conn, $mysql_qry);
if($result){
echo "order successful from $username";
} else {
echo mysql_error();
}
?>