我数了数,检查了逗号,并再次检查了整个过程,但我仍然找不到导致此错误的原因。它告诉我,我正在尝试输入比我给出的列名更多的信息,但我有 29 列和 29 个值。我可以看到没有缺少的逗号。
有人可以看看这个,看看我是否遗漏了什么?
$query = <<<EOD
insert into roster
(conference, regtime, participanttype_id, category_id, title,
firstname, lastname, badgename, jobtitle, department,
organization, address1, address2, address3, city,
state, country, postal, email, phone,
fax, paytype, feedue, f01, yn01,
yn02, yn03, yn04, other)
values
('event1023', now(), $sfund_partictype_id, $sfund_category_id, '$title',
'$firstname', '$lastname', '$badgename', '$jobtitle', '$deptname',
'$organization', '$address1', '$address2', '$address3', '$city',
'$state', '$country', '$postal', '$email', '$phone',
'$fax', '$paytype', $feedue, '$wedsession', '$yn01',
'$yn02', '$yn03', '$yn04', '$other')
EOD;
ETA:我把这个分开是因为过去对我帖子的批评表明我应该这样做。但在我的代码中不是这样。
ETA #2:这是奇怪的事情。这些值完美地进入数据库。但它仍然返回这个(并且也让我意识到 EEK 我的代码正在显示确切的错误,所以顺便说一句,是的,我会在它上线之前修复它):
查询失败:
insert into roster
(conference, regtime, participanttype_id, category_id, title,
firstname, lastname, badgename, jobtitle, department,
organization, address1, address2, address3, city,
state, country, postal, email, phone,
fax, paytype, feedue, f01, yn01,
yn02, yn03, yn04, other)
values
('event1023', now(), 3, 14, 'Ms',
'Jane','Smith','Jane Smith', 'Developer', 'my dept',
'my organization', 'my address', '','','my city',
'NC','United States','55555','me@email.edu','555-555-5555',
'', 'CHECK', 225, '2', '1',
'0', '1', '0', 'n/a')
Column count doesn't match value count at row 1