{"id":3058495,"date":"2012-09-20T10:36:30","date_gmt":"2012-09-20T10:36:30","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/wpdb-insert-problem-not-inserting-string\/"},"modified":"2016-08-20T15:48:38","modified_gmt":"2016-08-20T15:48:38","slug":"wpdb-insert-problem-not-inserting-string","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/wpdb-insert-problem-not-inserting-string\/","title":{"rendered":"$wpdb insert problem &#8211; not inserting string"},"content":{"rendered":"<p>I am trying to insert a new record into a table, and for the most part it&#8217;s working except for one string. Here&#8217;s my insert statement;<\/p>\n<p><code>$wpdb-&gt;insert($wpdb-&gt;uam_accessgroup_to_object, array(&#039;object_id&#039; =&gt; $userID, &#039;object_type&#039; =&gt; &#039;user&#039;, &#039;group_id&#039; =&gt; $entry[&#039;7&#039;]), array(&#039;%s&#039;, &#039;%d&#039;));<\/code><\/p>\n<p>It&#8217;s creating a new record and inserting the correct values into &#8216;object_id&#8217; and &#8216;group_id&#8217;, however &#8216;object_type&#8217; which should be &#8216;user&#8217; is saved in the db as &#8216;0&#8217;. The field type is varchar(255).<\/p>\n<p>Is there something wrong with my insert statement?<\/p>\n","protected":false},"template":"","class_list":["post-3058495","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3058495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3058495\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3058495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}