That's because you're not providing an integer value. If you want to insert NULL, the field definition must allow NULLS.
It appears to me that user_id would be an auto_increment field anyway and should be handled by the database engine. I could be wrong.