如何在PHP中解码JSON并将其插入到Mysql表中?

I'm using the following code in PHP.

Its creating the file post.json, but inserting values into the table is not reflecting.

<?php
$input = file_get_contents('php://input');
logToFile("post.json",$input);

$json_a = json_decode($input,true);

$con = mysql_connect("localhost","root","root");
if (!$con)
{
    die('Could not connect: ' . mysql_error());
}

mysql_select_db("mydb", $con);

mysql_query("INSERT INTO order_table (Table_id, Menu_Item_Name, Menu_Item_Price, Menu_Item_quantity) VALUES('$json_a[TableId]','$json_a[ItemName]','$json_a[ItemPrice]','$json_a[ItemQuantity]')");


function logToFile($filename,$msg)
{
    $fd = fopen($filename,"a");
    $str="[".date("Y/m/d h:i:s")."]".$msg;
    fwrite($fd,$str."
");
    fclose($fd);
}

?>

Try to replace '$json_a[foo]' with '" . $json_a['foo'] . "' or '${json_a['foo']}'.