Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 为web应用程序创建数据库。保留表的主键_Mysql_Web Applications - Fatal编程技术网

Mysql 为web应用程序创建数据库。保留表的主键

Mysql 为web应用程序创建数据库。保留表的主键,mysql,web-applications,Mysql,Web Applications,我正在开发一个web应用程序,但我对它还很陌生 基本思想: 用户登录并可以通过多种不同的表单输入数据。每个表单都应与用户连接,并按年份和月份进行编目 现在我的数据库结构是: core_user: id_user,username, password core_year: id_year, year core_month: id_month, month ch: id_ch, many variables... 我希望在core\u year、core\u month和ch中有注册id\u us

我正在开发一个web应用程序,但我对它还很陌生

基本思想:
用户登录并可以通过多种不同的表单输入数据。每个表单都应与用户连接,并按年份和月份进行编目

现在我的数据库结构是:

core_user: id_user,username, password
core_year: id_year, year
core_month: id_month, month
ch: id_ch, many variables...
我希望在
core\u year
core\u month
ch
中有注册
id\u user
的列,以便我可以检索和存储用户的数据,并按月份和年份进行存储

我试过用外键,但没有成功

我想要的是:

task--> user registered--> unique primary key=id_user
task--> year registered--> unique primary key=id_year with the id_user of the
                                                      session that is going on.
等等


有什么建议吗?

ch代表什么?为什么您希望年和月有单独的表,而不仅仅是表中的日期字段,该字段应该有
core\u year.id\u year
core\u month.id\u month
外键?或者,如果你愿意,你可以把它保留为年和月,但是如果没有额外的表,我想这与使用日期相比可能有一个或两个优点。你用外键做了什么尝试,在哪些方面没有成功?这应该不是问题,但您尚未描述问题。