issachan Posted April 19, 2010 Share Posted April 19, 2010 Hi all, I created a survey along with a database which is storing the results. I have tested my survey and code and it appears to work no problem. If someone leaves a null field I just store it in the database as is (I had to rush to put it together and send it out - deadlines you know)... Anyway I have received a few responses which are just zeros even for my drop-down fields! It doesn't replace all the fields, but replaces the majority. If they didn't put in a value or select something it should be set to the default or leave a blank space. Does anyone know what would cause something like this? Quote Link to comment https://forums.phpfreaks.com/topic/199046-problem-zeros-inserted-automatically-into-database/ Share on other sites More sharing options...
F1Fan Posted April 19, 2010 Share Posted April 19, 2010 Are these numeric data type columns? If they are, then there is no such thing as "blank." It can be a zero, and it can be NULL, but no blanks. So, you just need to check to see if it is empty/blank/zero and replace each of them with NULL. Quote Link to comment https://forums.phpfreaks.com/topic/199046-problem-zeros-inserted-automatically-into-database/#findComment-1044800 Share on other sites More sharing options...
issachan Posted April 19, 2010 Author Share Posted April 19, 2010 Ok, sounds easy enough! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/199046-problem-zeros-inserted-automatically-into-database/#findComment-1044801 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.