Skip to content
Advertisement

Tag: null

MySQL and PHP – insert NULL rather than empty string

I have a MySQL statement that inserts some variables into the database. I recently added 2 fields which are optional ($intLat, $intLng). Right now, if these values are not entered I pass along an empty string as a value. How do I pass an explicit NULL value to MySQL (if empty)? Answer To pass a NULL to MySQL, you do

Advertisement