null and boolean values with $wpdb->insert
-
When I try to insert null or true into a database using $wpdb->insert, it puts quotes around the values and MySQL chokes.
$data_array = array(JB_SOURCE_TITLE => $this->feed->get_title(), JB_SOURCE_DATERECEIVED => 'NULL'); $wpdb->insert( $wpdb->prefix . JB_SOURCETABLE, $data_array)
gives
WordPress database error: [Incorrect datetime value: 'NULL' for column 'dateReceived' at row 1] INSERT INTO <code>wp_jobboard_sources</code> (<code>title</code>,<code>dateReceived</code>) VALUES ('the feed','NULL')
Is there any workaround for this other than constructing the query from scratch?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘null and boolean values with $wpdb->insert’ is closed to new replies.