{"id":224,"date":"2012-02-25T00:20:13","date_gmt":"2012-02-25T00:20:13","guid":{"rendered":"13fe9d84310e77f13a6d184dbf1232f3"},"modified":"2012-02-25T00:20:13","modified_gmt":"2012-02-25T00:20:13","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/224","title":{"rendered":"MySqli \u9884\u5904\u7406"},"content":{"rendered":"<p>&nbsp;&nbsp; $mysqli = new mysqli(\"localhost\",\"root\",\"root\",\"test\");<br \/>\n&nbsp;&nbsp; $sql = \"insert into book (bookn,bookp,booka,addr)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values(?,?,?,?)\";<br \/>\n&nbsp;&nbsp; \/\/\u9884\u5904\u7406<br \/>\n&nbsp;&nbsp; $stmt = $mysqli -&gt; prepare($sql);<br \/>\n&nbsp;&nbsp; $stmt-&gt;bind_param(\"siss\",$bookn,$bookp,$booka,$addr);<br \/>\n&nbsp;&nbsp; $bookn = \"\u8ba1\u7b97\u673a\u79d1\u5b66\u5bfc\u8bba\";<br \/>\n&nbsp;&nbsp; $bookp = 11;<br \/>\n&nbsp;&nbsp; $booka = \"\u738b\u73b2\";<br \/>\n&nbsp;&nbsp; $addr = \"\u6e05\u534e\u5927\u5b66\u51fa\u7248\u793e\";<br \/>\n&nbsp;&nbsp; $stmt-&gt;execute();<br \/>\n&nbsp;&nbsp; <br \/>\n&nbsp;&nbsp; $bookn = \"\u5efa\u7b51\u7ed9\u6c34\u6392\u6c34\u5de5\u7a0b(\u7b2c5\u7248)\";<br \/>\n&nbsp;&nbsp; $bookp = 10;<br \/>\n&nbsp;&nbsp; $booka = \"\u738b\u589e\u957f\";<br \/>\n&nbsp;&nbsp; $addr = \"\u4e2d\u56fd\u5efa\u7b51\u5de5\u4e1a\u51fa\u7248\u793e\";<br \/>\n&nbsp;&nbsp; $stmt -&gt; execute();<br \/>\n&nbsp;&nbsp; echo($stmt -&gt; insert_id .\"&lt;br&gt;\");<br \/>\n&nbsp;&nbsp; echo($stmt -&gt; affected_rows);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp; $mysqli = new mysqli(\"localhost\",\"root\",\"root\",\"test\");<br \/>\n&nbsp;&nbsp; $sql = \"insert into book (bookn,bookp,booka,addr)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values(?,?,?,?)\";<br \/>\n&nbsp;&nbsp; \/\/\u9884\u5904\u7406<br \/>\n&nbsp;&nbsp; $stmt = $mysqli -&gt; prepare($sql);<br \/>\n&#038;nbsp... <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/224\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[288],"tags":[2,27],"class_list":["post-224","post","type-post","status-publish","format-standard","hentry","category-db","tag-MySQL","tag-php"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=224"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/224\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}