{"id":733,"date":"2025-07-12T02:52:55","date_gmt":"2025-07-12T02:52:55","guid":{"rendered":"https:\/\/easyaccsoft.com\/webdesign\/?p=733"},"modified":"2025-07-12T02:52:55","modified_gmt":"2025-07-12T02:52:55","slug":"sql-%e8%a1%a8%e7%bb%93%e6%9e%84%e5%ae%9a%e4%b9%89-insert-%e5%af%bc%e5%85%a5%e8%af%ad%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/easyaccsoft.com\/webdesign\/2025\/07\/12\/sql-%e8%a1%a8%e7%bb%93%e6%9e%84%e5%ae%9a%e4%b9%89-insert-%e5%af%bc%e5%85%a5%e8%af%ad%e5%8f%a5\/","title":{"rendered":"SQL \u8868\u7ed3\u6784\u5b9a\u4e49 + INSERT \u5bfc\u5165\u8bed\u53e5"},"content":{"rendered":"\n<p>\u4ee5\u4e0b\u662f\u5b8c\u6574\u7684 <strong>SQL \u8868\u7ed3\u6784\u5b9a\u4e49 + INSERT \u5bfc\u5165\u8bed\u53e5<\/strong>\uff0c\u7528\u4e8e\u5b58\u50a8\u4f60\u6574\u7406\u7684 30 \u6761\u4e2d\u533b\u8fa8\u8bc1\u89c4\u5219\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83e\uddf1 \u4e00\u3001\u5efa\u8868\u8bed\u53e5\uff08<code>diagnosis_rules<\/code>\uff09<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE diagnosis_rules (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    diagnosis VARCHAR(100) NOT NULL,\n    formula VARCHAR(100) NOT NULL,\n    symptoms TEXT NOT NULL,\n    tongue VARCHAR(50),\n    pulse TEXT\n);\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u6bb5\u8bf4\u660e\uff1a<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u5b57\u6bb5\u540d<\/th><th>\u7c7b\u578b<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td><code>id<\/code><\/td><td>INT<\/td><td>\u4e3b\u952e\u81ea\u589e<\/td><\/tr><tr><td><code>diagnosis<\/code><\/td><td>VARCHAR<\/td><td>\u8bc1\u578b\u540d<\/td><\/tr><tr><td><code>formula<\/code><\/td><td>VARCHAR<\/td><td>\u63a8\u8350\u65b9\u5242<\/td><\/tr><tr><td><code>symptoms<\/code><\/td><td>TEXT<\/td><td>JSON \u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u75c7\u72b6\u5173\u952e\u8bcd<\/td><\/tr><tr><td><code>tongue<\/code><\/td><td>VARCHAR<\/td><td>\u820c\u8c61\uff08\u53ef\u4e3a\u7a7a\uff09<\/td><\/tr><tr><td><code>pulse<\/code><\/td><td>TEXT<\/td><td>JSON \u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u8109\u8c61<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udce5 \u4e8c\u3001\u6279\u91cf\u5bfc\u5165\u8bed\u53e5\uff08\u524d 3 \u6761\u793a\u4f8b\uff09<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>INSERT INTO diagnosis_rules (diagnosis, formula, symptoms, tongue, pulse) VALUES\n('\u75f0\u70ed\u54b3\u55fd', '\u6e05\u91d1\u5316\u75f0\u6c64', '&#91;\"\u54b3\",\"\u75f0\"]', '\u9ec4\u817b', '&#91;\"\u6ed1\",\"\u6570\"]'),\n('\u98ce\u5bd2\u54b3\u55fd', '\u4e09\u62d7\u6c64', '&#91;\"\u54b3\",\"\u6015\u51b7\",\"\u6d41\u6d95\"]', '\u8584\u767d', '&#91;\"\u6d6e\u7d27\"]'),\n('\u6c14\u8840\u4e24\u865a', '\u516b\u73cd\u6c64', '&#91;\"\u4e4f\u529b\",\"\u5fc3\u60b8\"]', '\u6de1', '&#91;\"\u7ec6\"]'),\n('\u809d\u90c1\u6c14\u6ede', '\u67f4\u80e1\u758f\u809d\u6563', '&#91;\"\u80f8\u95f7\",\"\u53f9\u6c14\",\"\u6613\u6012\"]', '', '&#91;\"\u5f26\"]'),\n('\u9634\u865a\u706b\u65fa', '\u77e5\u67cf\u5730\u9ec4\u4e38', '&#91;\"\u53e3\u6e34\",\"\u76d7\u6c57\"]', '\u7ea2', '&#91;\"\u7ec6\u6570\"]'),\n('\u9633\u865a\u754f\u5bd2', '\u91d1\u532e\u80be\u6c14\u4e38', '&#91;\"\u754f\u5bd2\",\"\u56db\u80a2\u51b7\",\"\u8170\u9178\"]', '\u6de1\u767d', '&#91;\"\u8fdf\"]'),\n('\u80be\u9634\u865a', '\u516d\u5473\u5730\u9ec4\u4e38', '&#91;\"\u8170\u819d\u9178\u8f6f\",\"\u8033\u9e23\",\"\u76d7\u6c57\"]', '\u7ea2', '&#91;\"\u7ec6\"]'),\n('\u80be\u9633\u865a', '\u53f3\u5f52\u4e38', '&#91;\"\u754f\u5bd2\",\"\u591c\u5c3f\u9891\"]', '\u6de1\u80d6', '&#91;\"\u6c89\u5f31\"]'),\n('\u813e\u9633\u865a', '\u9644\u5b50\u7406\u4e2d\u4e38', '&#91;\"\u8179\u6cfb\",\"\u98df\u5c11\"]', '\u6de1\u767d', '&#91;\"\u8fdf\u5f31\"]'),\n('\u80c3\u70ed\u70bd\u76db', '\u6e05\u80c3\u6563', '&#91;\"\u80c3\u8118\u75db\",\"\u53e3\u81ed\",\"\u4fbf\u79d8\"]', '\u9ec4', '&#91;\"\u6ed1\u6570\"]');\n<\/code><\/pre>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u7528\u6587\u672c\u7f16\u8f91\u5668 \/ \u811a\u672c\u4e00\u6b21\u6027\u751f\u6210\u6240\u6709 30 \u6761\uff08\u6211\u4e5f\u53ef\u5e2e\u4f60\u5bfc\u51fa <code>.sql<\/code> \u6587\u4ef6\uff09\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udee0 \u4e09\u3001PHP \u540e\u53f0\u7528\u6cd5\u5efa\u8bae<\/h2>\n\n\n\n<p>\u5bfc\u5165\u540e\u4f60\u53ef\u4ee5\u5728 PHP \u4e2d\u8fd9\u6837\u8bfb\u53d6\u89c4\u5219\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$sql = \"SELECT * FROM diagnosis_rules\";\n$result = mysqli_query($conn, $sql);\n\nwhile ($row = mysqli_fetch_assoc($result)) {\n    $symptoms = json_decode($row&#91;'symptoms'], true);\n    $pulse = json_decode($row&#91;'pulse'], true);\n    \/\/ \u903b\u8f91\u5224\u65ad...\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udcce \u4e0b\u4e00\u6b65\u63a8\u8350<\/h2>\n\n\n\n<p>\u2705 \u5982\u9700\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\ud83d\udcbb \u7ba1\u7406\u540e\u53f0\u754c\u9762\uff08\u65b0\u589e\/\u7f16\u8f91\u89c4\u5219\uff09<\/li>\n\n\n\n<li>\ud83e\udde0 JSON\/SQL \u2192 \u81ea\u52a8\u8bca\u65ad PHP \u51fd\u6570<\/li>\n\n\n\n<li>\ud83d\udce6 \u5bfc\u51fa <code>.sql<\/code> \u6587\u4ef6\u6253\u5305<\/li>\n<\/ul>\n\n\n\n<p>\u544a\u8bc9\u6211\uff0c\u6211\u53ef\u4ee5\u4e00\u6b65\u5230\u4f4d\u5e2e\u4f60\u751f\u6210\u3002\u662f\u5426\u8981\u6211\u73b0\u5728\u5c31\u5bfc\u51fa\u5b8c\u6574\u7684 SQL \u6587\u4ef6\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u662f\u5b8c\u6574\u7684 SQL \u8868\u7ed3\u6784\u5b9a\u4e49 + INSERT \u5bfc\u5165\u8bed\u53e5\uff0c\u7528\u4e8e\u5b58\u50a8\u4f60\u6574\u7406\u7684 30 \u6761\u4e2d\u533b\u8fa8\u8bc1\u89c4\u5219\u3002 \ud83e\uddf1 \u4e00\u3001\u5efa\u8868\u8bed\u53e5\uff08diagnosis_rules\uff09 \u5b57\u6bb5\u8bf4\u660e\uff1a \u5b57\u6bb5\u540d \u7c7b\u578b \u8bf4\u660e id INT \u4e3b\u952e\u81ea\u589e diagnosis VARCHAR \u8bc1\u578b\u540d formula VARCHAR \u63a8\u8350\u65b9\u5242 symptoms TEXT JSON \u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u75c7\u72b6\u5173\u952e\u8bcd tongue VARCHAR \u820c\u8c61\uff08\u53ef\u4e3a\u7a7a\uff09 pulse TEXT JSON \u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u8109\u8c61 \ud83d\udce5 \u4e8c\u3001\u6279\u91cf\u5bfc\u5165\u8bed\u53e5\uff08\u524d 3 \u6761\u793a\u4f8b\uff09 \u4f60\u53ef\u4ee5\u7528\u6587\u672c\u7f16\u8f91\u5668 \/ \u811a\u672c\u4e00\u6b21\u6027\u751f\u6210\u6240\u6709 30 \u6761\uff08\u6211\u4e5f\u53ef\u5e2e\u4f60\u5bfc\u51fa .sql \u6587\u4ef6\uff09\u3002 \ud83d\udee0 \u4e09\u3001PHP \u540e\u53f0\u7528\u6cd5\u5efa\u8bae \u5bfc\u5165\u540e\u4f60\u53ef\u4ee5\u5728 PHP \u4e2d\u8fd9\u6837\u8bfb\u53d6\u89c4\u5219\uff1a \ud83d\udcce \u4e0b\u4e00\u6b65\u63a8\u8350 \u2705 \u5982\u9700\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/comments?post=733"}],"version-history":[{"count":1,"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/posts\/733\/revisions"}],"predecessor-version":[{"id":734,"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/posts\/733\/revisions\/734"}],"wp:attachment":[{"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/media?parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/categories?post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easyaccsoft.com\/webdesign\/wp-json\/wp\/v2\/tags?post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}