I am want to insert data into my phpmyadmin mysql database dynamically. So I get the values from user and then run the insert command of mysqli to insert the data.
But my insert command is not working. Here's my code:
$rest_name = $_SESSION['rest_name'];
$order = $_SESSION['order'];
$user = $_SESSION['username'];
$bill = $_SESSION['bill'];
$ctime = date("H:i:s", strtotime($_POST['time']));
$insert_sql = "INSERT INTO '$rest_name' ('orders','amount',
'time','username') VALUES('$order', '$bill', '$ctime','$user')';
echo $insert_sql;
if(mysqli_query($conn,$insert_sql)){
echo "done";
}
else{
echo "not done";
}
I have 6 columns in the database but i need insert for 4 columns only the other two are set to default value.