我有一个 JSON 字符串
{"name":"jack","school":"colorado state","city":"NJ","id":null}
我需要将其保存在数据库中。我怎么能这样做?
我的 PHP 代码(我只建立了与 MySQL 的连接,但我无法保存记录)
<?php
// the MySQL Connection
mysql_connect("localhost", "username", "pwd") or die(mysql_error());
mysql_select_db("studentdatabase") or die(mysql_error());
// Insert statement
mysql_query("INSERT INTO student
(name, school,city) VALUES(------------------------- ) ") // (How to write this)
or die(mysql_error());
echo "Data Inserted or failed";
?>