dongtan1009 2013-05-13 04:59
浏览 19

对于存储此表单中的数据感到困惑

I have been practising mysql and then I have came across an issue that I can't solve. I am making a large form that will be able to store information from user in the database. I have managed to make and store data from simple form fields like Name, Country, Age, Interest and etc using mysql and php.

I have a table called users in my database which have approximate 15 column for different data like Name, Country, Age etc.

Now I have added this from field to my from and confused about how to store data from this field.

Here is the img of my form ....

see the pic

Now if I create a column emp_name then how am I going to store 1-4 values for each user with 5 fields each?

Even if I create a different table ex - emp_history then how to store data from this form for each user?

  • 写回答

3条回答 默认 最新

  • dongzaliang4492 2013-05-13 05:08
    关注

    Create two tables

    tbl_more_detail ( here you store all for info 1-4)

    id (PK)
    emp_id
    emp_name
    emp_country
    emp_position
    emp_from
    emp_to

    tbl_emp_detail ( here you give reference to above ids, will have 4 rows with different detail_id)

    id(PK)
    emp_id
    detail_id ( FK Refer to tbl_more_detail.id)

    NOTE: to prevent duplicate entry, create UNIQUE KEY INDEX on (emp_id, detail_id)

    评论

报告相同问题?

悬赏问题

  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据