how to echo posted JSON data in php -
i trying display data in php echo not why displays nothing when it.
$data = json_decode(file_get_contents("php://input")); $code = mysql_real_escape_string($data->code); $name = mysql_real_escape_string($data->name); mysql_connect("localhost", "root", "thanh03021986") or die(mysql_error()); mysql_select_db("erp") or die(mysql_error()); echo $name; mysql_query("insert element(`code`, `name` ) values('".$code."','".$name."')");
it obvious $name
has value when posted echo
display nothing. also, how can convert php data use?
Comments
Post a Comment