Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL defaults

Status
Not open for further replies.

aarrgghh

Technical User
Sep 5, 2002
60
US
Hey everyone,

I am having a problem. I am using MySQL to record data collected through an internet survey. Not every question within the survey requires a response. For those questions, I want to make use of the "default value" feature of MySQL tables. My problem is that I get blanks or a zero in the field that correspondes to the survey question that has been left unanswered. These values are recorded instead of the default value I specified. What are your thoughts on how this can be solved? I know I could use php to apply a vlaue to unanswered questions, but I want to limit the code to increase the speed of processing and decrease my time spent writing the code.

Thanks in advance
 
You're probably going to have to write the code anyway. The default value is used when a column is not mentioned in an insert statement -- to be able to use the default, you're going to have to add logic to explicitly not use the column in the queries you build. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top