Drupal won't set values to NULL with db_query %d system
removed bug from taxonomy_location_save that was put in while trying, and failing, to put in a NULL value with a Drupal query
ben-agaric: Is there any special trick to getting db_query to stick a NULL into a database table? It allows NULL and I can set a value to NULL in phpMyAdmin
[7:35pm] beeradb: will you pastebin your query?
[7:37pm] ben-agaric: db_query("UPDATE {term_location} SET latitude = %d, longitude = %d WHERE tid = %d", $term_location['latitude'], $term_location['longitude'], $tid);
[7:37pm] ben-agaric: (doesn't really need pastebin!)
[7:38pm] ben-agaric: And I've replaced the variables with NULL directly, I think I tried putting the %d in '%d' and tried '%s' too....
beeradb: why not set latitude = null
[7:39pm] beeradb: directly in the query
[7:40pm] beeradb: asusming that's the field you want to set null, of course:)
[7:40pm] ben-agaric: So 'if my values are null, run an entirely different query' ?
[7:40pm] ben-agaric: I was sort of hoping that wasn't the Drupal way
[7:40pm] josh_k left the chat room. (Read error: 110 (Connection timed out))
[7:41pm] calebg: The Drupal way.......that makes you nutz.
[7:41pm] beeradb: well, it's really a sql thing, a empty variable or null in php isn't going to be translated in "null" in sql
[7:41pm] • calebg pets Drupal
Comments
Post new comment