gpt4 book ai didi

php - 尝试添加新用户,但出现此错误

转载 作者:行者123 更新时间:2023-11-29 07:48:06 31 4
gpt4 key购买 nike

登录 php 网站遇到错误

Incorrect integer value: '' for column 'id' at row 1

数据库代码

  -- Table structure for table `user`


CREATE TABLE `user` (
`id` int(11) NOT NULL auto_increment,
`name` text NOT NULL,
`lname` text NOT NULL,
`father` text NOT NULL,
`username` text NOT NULL,
`password` text NOT NULL,
`flag` enum('0','1') NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`id`, `name`, `lname`, `father`, `username`, `password`, `flag`) VALUES
(1, 'yasha', 'asadpoor', 'akbari', 'yashaaa', '123456', '1'),
(2, '1', '2', '3', '4', '5', '1'),
(3, 'm', 'm', 'm', 'm', 'm', '1');

最佳答案

为了利用列的自动递增功能,插入行时不要为该列提供值。数据库将为您提供一个值。


INSERT INTO <code>user</code> (<code>name</code>, <code>lname</code>, <code>father</code>, <code>username</code>, <code>password</code>, <code>flag</code>) VALUES
( 'yasha', 'asadpoor', 'akbari', 'yashaaa', '123456', '1'),
( '1', '2', '3', '4', '5', '1'),
( 'm', 'm', 'm', 'm', 'm', '1');

查看此 question

关于php - 尝试添加新用户,但出现此错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27188650/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com