dongyukui8330 2012-04-07 18:27
浏览 31
已采纳

在存储到数据库之前添加到用户输入值

I have a form whereby a user fills it in and clicks submit. This then stores the information in the database. I have a field called height. And I want the user to type in something like 10, but I dont want them to type in the measurement aswel. I want this to be added to '10' before storing in the database

So when they click 10 and submit, i want it to show in the database as 10inches or 10".

I tried to google it but I get nothing because I have to be quite specific with keywords and I just dont know how to search it.

Does anybody know how I can achieve this?

  • 写回答

2条回答 默认 最新

  • douying7289 2012-04-07 18:29
    关注

    Why do you want to store this in the database as text? That should not be a database concern, but instead be a UI concern. Store the 10, and just add the inches when you pull the data out?

    Or you could store the 10 as a value alongside a mapping to what type it is (such as inches/cm/etc). This design will give you much more flexibility

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线