{"id":13,"date":"2021-09-15T23:03:48","date_gmt":"2021-09-15T14:03:48","guid":{"rendered":"https:\/\/memo-log.net\/?p=13"},"modified":"2022-05-19T05:12:13","modified_gmt":"2022-05-18T20:12:13","slug":"wpdb-insert%e3%81%a7auto_increment%e3%81%a7%e6%95%b0%e5%80%a4%e5%9e%8b%e3%81%aeid%e7%95%aa%e5%8f%b7%e3%82%92%e6%8c%bf%e5%85%a5%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/memo-log.net\/?p=13","title":{"rendered":"$wpdb->insert\u3067AUTO_INCREMENT\u306e\u6570\u5024\u578bid\u756a\u53f7\u3092\u633f\u5165\u3059\u308b"},"content":{"rendered":"\n<p>\u30b3\u30fc\u30c99\u884c\u76ee\u306eID\u756a\u53f7<br>\u9023\u756a\u306a\u306e\u3067\u3069\u3093\u306a\u6570\u5024\u304c\u5165\u308b\u304b\u5206\u304b\u3089\u306a\u3044\u3002<br>\u300cint\u6570\u5024\u578b\u3067\u7a7a\u306e\u5024\u3092\u5165\u308c\u305f\u3089\u3044\u3044\u304b\u306a\u300d\u3068\u8003\u3048\u305f\u3002<\/p>\n\n\n\n<p>\u3067\u3001&#8217; &#8216;\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u308f\u305a\u306b<br>&#8216;ID&#8217; =&gt; ,<br>\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002<\/p>\n\n\n\n<p>\u6587\u5b57\u5217\u3068\u540c\u3058\u306b<br>&#8216;ID&#8217; =&gt; &#8221;,<br>\u3068\u3057\u305f\u3089\u30a4\u30b1\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-lang=\"PHP\"><code>global $wpdb;\n$poststable = $wpdb-&gt;prefix. &#39;posts&#39;;\n$datetime = current_time( &#39;mysql&#39; );\n$gmttime = current_time( &#39;mysql&#39;, true );\/\/\u7b2c\uff12\u5f15\u6570\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306ffalse(\u65e5\u672c\u6642\u9593)\u3002true\u3067gmt\u6642\u9593\n$css = &#39;.modal { display: none; } a[data-micromodal-trigger], button[data-micromodal-trigger] { pointer-events: none; opacity: 0.5; }&#39;;\n$theme = get_stylesheet();\n\n$data = array(\n\t&#39;ID&#39; =&gt; &#39;&#39;,\/\/auto_incriment\u3067%d\u3067\u3082&#39;&#39;\u3067\u9023\u756a\u51e6\u7406\u3057\u3066\u304f\u308c\u308b\n\t&#39;post_author&#39; =&gt; 1,\n\t&#39;post_date&#39; =&gt; $datetime,\n\t&#39;post_date_gmt&#39; =&gt; $gmttime,\n\t&#39;post_content&#39; =&gt; $css,\n\t&#39;post_title&#39; =&gt; $theme,\n\t&#39;post_excerpt&#39; =&gt; &#39;&#39;,\n\t&#39;post_status&#39; =&gt; &#39;publish&#39;,\n\t&#39;comment_status&#39; =&gt; &#39;closed&#39;,\n\t&#39;ping_status&#39; =&gt; &#39;closed&#39;,\n\t&#39;post_password&#39; =&gt; &#39;&#39;,\n\t&#39;post_name&#39; =&gt; $theme,\n\t&#39;to_ping&#39; =&gt; &#39;&#39;,\n\t&#39;pinged&#39; =&gt; &#39;&#39;,\n\t&#39;post_modified&#39; =&gt; $datetime,\n\t&#39;post_modified_gmt&#39; =&gt; $gmttime,\n\t&#39;post_content_filtered&#39; =&gt; &#39;&#39;,\n\t&#39;post_parent&#39; =&gt; 0,\n\t&#39;guid&#39; =&gt; home_url( &#39;\/&#39;. $theme. &#39;\/&#39; ),\n\t&#39;menu_order&#39; =&gt; 0,\n\t&#39;post_type&#39; =&gt; &#39;custom_css&#39;,\n\t&#39;post_mime_type&#39; =&gt; &#39;&#39;,\n\t&#39;comment_count&#39; =&gt; 0,\n);\n\n$format = array(\n\t&#39;%d&#39;, \/\/ID\n\t&#39;%d&#39;, \/\/post_author\n\t&#39;%s&#39;, \/\/post_date\n\t&#39;%s&#39;, \/\/post_date_gmt\n\t&#39;%s&#39;, \/\/post_content\n\t&#39;%s&#39;, \/\/post_title\n\t&#39;%s&#39;, \/\/post_excerpt\n\t&#39;%s&#39;, \/\/post_status\n\t&#39;%s&#39;, \/\/comment_status\n\t&#39;%s&#39;, \/\/ping_status\n\t&#39;%s&#39;, \/\/post_password\n\t&#39;%s&#39;, \/\/post_name\n\t&#39;%s&#39;, \/\/to_ping\n\t&#39;%s&#39;, \/\/pinged\n\t&#39;%s&#39;, \/\/post_modified\n\t&#39;%s&#39;, \/\/post_modified_gmt\n\t&#39;%s&#39;, \/\/post_content_filtered\n\t&#39;%d&#39;, \/\/post_parent\n\t&#39;%s&#39;, \/\/guid\n\t&#39;%d&#39;, \/\/menu_order\n\t&#39;%s&#39;, \/\/post_type\n\t&#39;%s&#39;, \/\/post_mime_type\n\t&#39;%d&#39;, \/\/comment_count\n);\n\n$wpdb-&gt;insert( $poststable, $data, $format );<\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b3\u30fc\u30c99\u884c\u76ee\u306eID\u756a\u53f7\u9023\u756a\u306a\u306e\u3067\u3069\u3093\u306a\u6570\u5024\u304c\u5165\u308b\u304b\u5206\u304b\u3089\u306a\u3044\u3002\u300cint\u6570\u5024\u578b\u3067\u7a7a\u306e\u5024\u3092\u5165\u308c\u305f\u3089\u3044\u3044\u304b\u306a\u300d\u3068\u8003\u3048\u305f\u3002 \u3067\u3001&#8217; &#8216;\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u308f\u305a\u306b&#8216;ID&#8217; =&gt; [&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":[3],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/memo-log.net\/index.php?rest_route=\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/memo-log.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/memo-log.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/memo-log.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/memo-log.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13"}],"version-history":[{"count":0,"href":"https:\/\/memo-log.net\/index.php?rest_route=\/wp\/v2\/posts\/13\/revisions"}],"wp:attachment":[{"href":"https:\/\/memo-log.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/memo-log.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/memo-log.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}