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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -