我用什么数据类型用于复选框和单选按钮,输入类型=日期在pmySQL中?
<pre>
<tr>
<td class="right_align">*Occupation : </td>
<td>
<input type="radio" name="occupation" value="student" />Student<br />
<input type="radio" name="occupation" value="business" />Business<br />
<input type="radio" name="occupation" value="pvtsect" />Priavte Sector<br />
<input type="radio" name="occupation" value="govtsect" />Govt. Sector<br />
<input type="radio" name="occupation" value="others" />Others<br />
</td>
</tr>
<tr>
<td class="right_align">*On which project you want to work :</td>
<td>
<input type="checkbox" name="" ="projectname" value="shine"/>Project Shine<br />
<input type="checkbox" name="" ="projectname" value="sahyog" />Project Sahyog<br />
<input type="checkbox" name="" ="projectname" value="smile" />Spreading Smiles
</td>
</tr>
</pre>
答案 0 :(得分:0)
1)你将获得string作为radio的值,因此它将是varchar类型
2)对于复选框,任何一个都可以有多个值,因此您需要为此值创建一个单独的表(working_project)(数据类型与radio相同)和另一个用于映射的表(user_working_project)
user_working_project表将包含用户ID和工作项目ID
例如,一个用户的id = 1,而working_project = 1,2
然后在你的user_working_project表中,条目将是这样的:
user_working_project_id working_project_id user_id
1 1 1
2 2 1