简体   繁体   English

第1行的“ student_id”列的整数值不正确:“ DEFAULT”

[英]Incorrect integer value: 'DEFAULT' for column 'student_id' at row 1

I'm receiving the following error code when trying to "Add a New Student" to MySQL database scheduler program: 尝试将“添加新学生”添加到MySQL数据库调度程序时,我收到以下错误代码:

Invalid query: 查询无效:

INSERT INTO student(student_id, name, password, number_paid_lessons, paid_from_date, paid_until_date) VALUES('DEFAULT', 'Test Student', 'Test Password', 12, '2014-1-01', '2014-3-31')

Incorrect integer value: 'DEFAULT' for column 'student_id' at row 1 第1行的“ student_id”列的整数值不正确:“ DEFAULT”

The tech staff at my hosting company explained: "Means that the incorrect mysql value is DEFAULT into row student_id." 我的托管公司的技术人员解释说:“这意味着不正确的mysql值默认为Student_id行。”

Coding is in php...How to fix? 编码在php中...如何解决? Do I just need to change the insert.php page code...or...the student.php page code? 我只需要更改insert.php页面代码...还是... student.php页面代码? If so, to what? 如果是这样,该怎么办?

Don't pass 'DEFAULT' . 不要通过'DEFAULT' Just leave that column out of your column list and values list, and the default will get inserted automatically. 只需将该列从列列表和值列表中删除,即可自动插入默认值。

Assuming your student_id column has a set default value you do not need to specify it in your query for the default value to be applied. 假设您的student_id列具有设置的默认值,则无需在查询中指定要应用的默认值。

INSERT INTO student(name, password, number_paid_lessons, paid_from_date, paid_until_date) 
VALUES('Test Student', 'Test Password', 12, '2014-1-01', '2014-3-31')

If student_id is an autoincrement field, just leave it empty 如果student_id是一个自动增量字段,则将其保留为空

INSERT INTO student(student_id, name, password, number_paid_lessons, paid_from_date, paid_until_date) 
VALUES('', 'Test Student', 'Test Password', 12, '2014-1-01', '2014-3-31')

Else, give a number instead of default 否则,请输入数字而不是默认值

INSERT INTO student(student_id, name, password, number_paid_lessons, paid_from_date, paid_until_date) 
VALUES(1, 'Test Student', 'Test Password', 12, '2014-1-01', '2014-3-31')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM