{"id":927,"date":"2014-02-15T15:03:20","date_gmt":"2014-02-15T15:03:20","guid":{"rendered":"https:\/\/cowman-chiang.no-ip.org\/wordpress\/?p=927"},"modified":"2019-06-20T10:25:42","modified_gmt":"2019-06-20T02:25:42","slug":"%e6%aa%a2%e6%9f%a5%e6%ac%84%e4%bd%8d%e6%98%af%e5%90%a6%e5%b7%b2%e5%ad%98%e5%9c%a8","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=927","title":{"rendered":"\u6aa2\u67e5\u6b04\u4f4d\u662f\u5426\u5df2\u5b58\u5728"},"content":{"rendered":"<p>\u4f7f\u7528 query \u8a9e\u6cd5\u65b0\u589e\u6b04\u4f4d\u6642\uff0c\u901a\u5e38\u8981\u8a18\u5f97\u5148\u6aa2\u67e5\u6b04\u4f4d\u662f\u5426\u5df2\u5b58\u5728\u624d\u6bd4\u8f03\u59a5\u7576<br \/>\n\u800c\u8a9e\u6cd5\u5982\u4e0b<br \/>\n<!--more--><\/p>\n<pre lang=\"php\"> \n$sqlb=\"SELECT count(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='\u6aa2\u67e5\u4e4b\u8cc7\u6599\u5eab\u540d\u7a31' AND TABLE_NAME='\u6aa2\u67e5\u4e4b\u8cc7\u6599\u8868\u540d\u7a31' AND COLUMN_NAME='\u6aa2\u67e5\u4e4b\u6b04\u4f4d\u540d\u7a31'\";\n  $result3 = mysql_query($sqlb) or die(\"\u67e5\u8a62 Query 1a \u932f\u8aa4\" . mysql_error( ));\n  while($rowb = mysql_fetch_array($result3)){\n    $check=$rowb[\"count(*)\"];\n  }\n  if(!$check){\/*\u5047\u8a2d\u6c92\u6709\u91cd\u8907\uff0c\u5247\u53ef\u4ee5\u65b0\u589e\u6b04\u4f4d*\/\n    $sqlb=\"alter table \u8cc7\u6599\u8868 ADD `\u6b04\u4f4d\u540d\u7a31` INT(5) default 0 not null\";\n    $result3 = mysql_query($sqlb) or die(\"\u65b0\u589e\u6b04\u4f4da\u932f\u8aa4\" . mysql_error( ));\n  }\n<\/pre>\n<p>\u800c\u65b0\u589e\u8cc7\u6599\u8868\u6642\u4e5f\u53ef\u4ee5\u670d\u6cd5\u6ce1\u88fd<\/p>\n<pre lang=\"php\">\n$sqlb=\"SELECT count(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='\u6aa2\u67e5\u4e4b\u8cc7\u6599\u5eab\u540d\u7a31' AND TABLE_NAME='\u6aa2\u67e5\u4e4b\u8cc7\u6599\u8868\u540d\u7a31'\";\n  $result3 = mysql_query($sqlb) or die(\"\u67e5\u8a62 Query 1a \u932f\u8aa4\" . mysql_error( ));\n  while($rowb = mysql_fetch_array($result3)){\n    $check=$rowb[\"count(*)\"];\n  }\n  if(!$check){\/*\u5047\u8a2d\u6c92\u6709\u91cd\u8907\uff0c\u9032\u884c\u4ee5\u4e0b\u52d5\u4f5c*\/\n  }\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 query \u8a9e\u6cd5\u65b0\u589e\u6b04\u4f4d\u6642\uff0c\u901a\u5e38\u8981\u8a18\u5f97\u5148\u6aa2\u67e5\u6b04\u4f4d\u662f\u5426\u5df2\u5b58\u5728\u624d\u6bd4\u8f03\u59a5\u7576 \u800c\u8a9e\u6cd5\u5982\u4e0b<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62,70],"tags":[],"class_list":["post-927","post","type-post","status-publish","format-standard","hentry","category-mysql","category-php"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=927"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/927\/revisions"}],"predecessor-version":[{"id":2063,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/927\/revisions\/2063"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}