Wordpress databse insert() and update() - using NULL values

Posted by pygorex1 on Stack Overflow See other posts from Stack Overflow or by pygorex1
Published on 2010-04-08T01:18:33Z Indexed on 2010/04/08 1:23 UTC
Read the original article Hit count: 379

Filed under:
|
|
|
|

Wordpress ships with the wpdb class which handles CRUD operations. The two methods of this class that I'm interested in are the insert() (the C in CRUD) and update() (the U in CRUD).

A problem arises when I want to insert a NULL into a mysql database column - the wpdb class escapes PHP null variables to empty strings. How can I tell Wordpress to use an actual MySQL NULL instead of a MySQL string?

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about mysql