{"id":6803,"date":"2024-11-14T11:26:00","date_gmt":"2024-11-14T03:26:00","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6803\/"},"modified":"2024-11-14T11:26:00","modified_gmt":"2024-11-14T03:26:00","slug":"mysql%e6%96%b0%e5%bb%ba%e8%a7%a6%e5%8f%91%e5%99%a8%e6%8a%a5%e9%94%99%ef%bc%9a1064-you-have-an-error-in-your-sql-syntax-%e5%a6%82%e4%bd%95%e6%8e%92%e6%9f%a5%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6803\/","title":{"rendered":"MySQL\u65b0\u5efa\u89e6\u53d1\u5668\u62a5\u9519\uff1a1064 &#8211; You have an error in your SQL syntax&#8230; \u5982\u4f55\u6392\u67e5\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/172993627350476.jpg\" class=\"aligncenter\" title=\"MySQL\u65b0\u5efa\u89e6\u53d1\u5668\u62a5\u9519\uff1a1064 &#8211; You have an error in your SQL syntax&#8230; \u5982\u4f55\u6392\u67e5\uff1f\u63d2\u56fe\" alt=\"MySQL\u65b0\u5efa\u89e6\u53d1\u5668\u62a5\u9519\uff1a1064 &#8211; You have an error in your SQL syntax&#8230; \u5982\u4f55\u6392\u67e5\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u65b0\u5efa\u89e6\u53d1\u5668\u4e3a\u4ec0\u4e48\u62a5\u9519<\/strong><\/p>\n<p>\u5728mysql\u4e2d\u521b\u5efa\u89e6\u53d1\u5668\u65f6\uff0c\u9047\u5230\u4ee5\u4e0b\u9519\u8bef\uff1a<\/p>\n<pre>1064 - you have an error in your sql syntax...<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u9519\u8bef\u6307\u793a\u5b58\u5728sql\u8bed\u6cd5\u9519\u8bef\uff0c\u5177\u4f53\u4f4d\u7f6e\u5728\uff1a<\/p>\n<pre>IF  NEW.ent_status='3'&lt;br&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; THEN &lt;br&gt;&nbsp;&nbsp;&nbsp; INSERT  INTO sand_grading<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0b\u662f\u53ef\u80fd\u5bfc\u81f4\u9519\u8bef\u7684\u4e00\u4e9b\u6392\u67e5\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li> <strong>\u7a7a\u683c\u95ee\u9898\uff1a<\/strong>\u8bed\u6cd5\u4e2d\u7684\u7a7a\u683c\u5b58\u5728\u95ee\u9898\uff0c\u8bf7\u4ed4\u7ec6\u68c0\u67e5\u8bed\u53e5\u4e2d\u662f\u5426\u5b58\u5728\u591a\u4f59\u6216\u7f3a\u5c11\u7684\u7a7a\u683c\u3002\u5c24\u5176\u662f<strong>then<\/strong>\u548c<strong>into<\/strong>\u5173\u952e\u5b57\u524d\u540e\u3002<\/li>\n<li> <strong>\u5206\u9694\u7b26\u95ee\u9898\uff1a<\/strong>\u786e\u4fdd\u89e6\u53d1\u5668\u5b9a\u4e49\u8bed\u53e5\u4ee5\u5206\u9694\u7b26\uff08\u5728\u672c\u4f8b\u4e2d\u4e3a$$\uff09\u5f00\u5934\u548c\u7ed3\u5c3e\u3002<\/li>\n<li> <strong>\u5173\u952e\u5b57\u5927\u5c0f\u5199\uff1a<\/strong>mysql\u5173\u952e\u5b57\uff08\u4f8b\u5982new\u3001then\u3001insert\uff09\u5fc5\u987b\u91c7\u7528\u5927\u5199\u5f62\u5f0f\u3002<\/li>\n<li> <strong>\u6570\u636e\u5e93\u6743\u9650\uff1a<\/strong>\u68c0\u67e5\u60a8\u662f\u5426\u6709\u521b\u5efa\u89e6\u53d1\u5668\u7684\u6743\u9650\u3002<\/li>\n<\/ol>\n<p>\u89e3\u51b3\u9519\u8bef\u540e\uff0c\u8bf7\u91cd\u65b0\u5c1d\u8bd5\u521b\u5efa\u89e6\u53d1\u5668\u3002\u5982\u679c\u4ecd\u7136\u65e0\u6cd5\u89e3\u51b3\uff0c\u8bf7\u63d0\u4f9b\u66f4\u8be6\u7ec6\u7684\u9519\u8bef\u6d88\u606f\u6216\u89e6\u53d1\u5668\u4ee3\u7801\u4ee5\u83b7\u5f97\u8fdb\u4e00\u6b65\u7684\u5e2e\u52a9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL\u65b0\u5efa\u89e6\u53d1\u5668\u62a5\u9519\uff1a1064 &#8211; You have an error in your SQL syntax&#8230; \u5982\u4f55\u6392\u67e5\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b0\u5efa\u89e6\u53d1\u5668\u4e3a\u4ec0\u4e48\u62a5\u9519 \u5728mysql\u4e2d\u521b\u5efa\u89e6\u53d1\u5668\u65f6\uff0c\u9047\u5230\u4ee5\u4e0b\u9519\u8bef\uff1a 1064 &#8211; you have an error in your sql syntax&#8230; \u767b\u5f55\u540e\u590d\u5236 \u9519\u8bef\u6307\u793a\u5b58\u5728sql\u8bed\u6cd5\u9519\u8bef\uff0c\u5177\u4f53\u4f4d\u7f6e\u5728\uff1a IF NEW.ent_status=&#8217;3&#8242;&lt;br&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; THEN &lt;br&gt;&nbsp;&nbsp;&nbsp; INSERT INTO sand_grading \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0b\u662f\u53ef\u80fd\u5bfc\u81f4\u9519\u8bef\u7684\u4e00\u4e9b\u6392\u67e5\u6b65\u9aa4\uff1a \u7a7a\u683c\u95ee\u9898\uff1a\u8bed\u6cd5\u4e2d\u7684\u7a7a\u683c\u5b58\u5728\u95ee\u9898\uff0c\u8bf7\u4ed4\u7ec6\u68c0\u67e5\u8bed\u53e5\u4e2d\u662f\u5426\u5b58\u5728\u591a\u4f59\u6216\u7f3a\u5c11\u7684\u7a7a\u683c\u3002\u5c24\u5176\u662fthen\u548cinto\u5173\u952e\u5b57\u524d\u540e\u3002 \u5206\u9694\u7b26\u95ee\u9898\uff1a\u786e\u4fdd\u89e6\u53d1\u5668\u5b9a\u4e49\u8bed\u53e5\u4ee5\u5206\u9694\u7b26\uff08\u5728\u672c\u4f8b\u4e2d\u4e3a$$\uff09\u5f00\u5934\u548c\u7ed3\u5c3e\u3002 \u5173\u952e\u5b57\u5927\u5c0f\u5199\uff1amysql\u5173\u952e\u5b57\uff08\u4f8b\u5982new\u3001then\u3001insert\uff09\u5fc5\u987b\u91c7\u7528\u5927\u5199\u5f62\u5f0f\u3002 \u6570\u636e\u5e93\u6743\u9650\uff1a\u68c0\u67e5\u60a8\u662f\u5426\u6709\u521b\u5efa\u89e6\u53d1\u5668\u7684\u6743\u9650\u3002 \u89e3\u51b3\u9519\u8bef\u540e\uff0c\u8bf7\u91cd\u65b0\u5c1d\u8bd5\u521b\u5efa\u89e6\u53d1\u5668\u3002\u5982\u679c\u4ecd\u7136\u65e0\u6cd5\u89e3\u51b3\uff0c\u8bf7\u63d0\u4f9b\u66f4\u8be6\u7ec6\u7684\u9519\u8bef\u6d88\u606f\u6216\u89e6\u53d1\u5668\u4ee3\u7801\u4ee5\u83b7\u5f97\u8fdb\u4e00\u6b65\u7684\u5e2e\u52a9\u3002 \u4ee5\u4e0a\u5c31\u662fMySQL\u65b0\u5efa\u89e6\u53d1\u5668\u62a5\u9519\uff1a1064 &#8211; You have an error in your SQL syntax&#8230; \u5982\u4f55\u6392\u67e5\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6803","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6803"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6803\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}