Error: Unknown column 'ID' in 'where clause'
Posted: Mon May 05, 2025 8:29 pm
I have verified that the object names I've given to the various editboxes on my form exactly match the column names in the database table I've created, but the data from my form input fields is not being posted to the database. Individual records are being created showing the system generated timestamp and URL data, which proves that it's working, and emails are being generated. The system did generate the timestamp/URL etc columns when I first tested the process, and did not generate any other new columns from the form user input objects when the form was processed, suggesting that there are no incompatibilities between the form's object names and the database table's column names, but I get the error message relating to an unknown column "ID". I'm aware that the php code that generates the timestamp/URL etc is separate from the code used to process the user input data, but can you provide any insight about the failure to post the user input data to the database? Surely I should be able to use my own names for the form's input objects?
All the code is wholly WYSIWYG generated. There are no hidden objects. Below is the error message, a dump of the table structure, and a couple of rows that have been created in the table.
ERROR MESSAGE:
<div id="container">
<div id="wb_Text1" style="position:absolute;left:151px;top:184px;width:275px;height:47px;z-index:0;">
<span style="color:#000000;font-family:'Times New Roman';font-size:16px;">Unknown column 'ID' in 'where clause'<br></span></div>
</div>
DB TABLE STRUCTURE
CREATE TABLE `screaming_swift` (
`Count_id` smallint(5) UNSIGNED NOT NULL,
`Location_id` smallint(6) NOT NULL,
`Street` tinytext NOT NULL COMMENT 'Street or grid reference',
`Survey_date` date NOT NULL COMMENT 'Date of count',
`Survey_start_time` time NOT NULL COMMENT 'Time of count',
`Count` tinyint(4) NOT NULL COMMENT 'Nos. birds',
`Building_type` tinytext NOT NULL COMMENT 'Building type',
`Building_age` smallint(4) NOT NULL COMMENT 'Approximate year built',
`email` tinytext NOT NULL COMMENT 'Submitter email ',
`Comments` text NOT NULL,
`DATESTAMP` date DEFAULT NULL,
`IP` varchar(15) DEFAULT NULL,
`BROWSER` varchar(255) DEFAULT NULL,
`FORMID` varchar(255) DEFAULT NULL,
`SUBMIT` varchar(255) DEFAULT NULL,
`TIME` varchar(8) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
DATA DUMP
INSERT INTO `screaming_swift` (`Count_id`, `Location_id`, `Street`, `Survey_date`, `Survey_start_time`, `Count`, `Building_type`, `Building_age`, `email`, `Comments`, `DATESTAMP`, `IP`, `BROWSER`, `FORMID`, `SUBMIT`, `TIME`) VALUES
DATA
(7, 0, '', '0000-00-00', '00:00:00', 0, '', 0, '', '', '2025-05-04', '2a00
ff85:', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0', NULL, NULL, '21:58:48'),
(8, 0, '', '0000-00-00', '00:00:00', 0, '', 0, '', '', '2025-05-04', '2a00
ff85:', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0', NULL, NULL, '22:40:55');
All the code is wholly WYSIWYG generated. There are no hidden objects. Below is the error message, a dump of the table structure, and a couple of rows that have been created in the table.
ERROR MESSAGE:
<div id="container">
<div id="wb_Text1" style="position:absolute;left:151px;top:184px;width:275px;height:47px;z-index:0;">
<span style="color:#000000;font-family:'Times New Roman';font-size:16px;">Unknown column 'ID' in 'where clause'<br></span></div>
</div>
DB TABLE STRUCTURE
CREATE TABLE `screaming_swift` (
`Count_id` smallint(5) UNSIGNED NOT NULL,
`Location_id` smallint(6) NOT NULL,
`Street` tinytext NOT NULL COMMENT 'Street or grid reference',
`Survey_date` date NOT NULL COMMENT 'Date of count',
`Survey_start_time` time NOT NULL COMMENT 'Time of count',
`Count` tinyint(4) NOT NULL COMMENT 'Nos. birds',
`Building_type` tinytext NOT NULL COMMENT 'Building type',
`Building_age` smallint(4) NOT NULL COMMENT 'Approximate year built',
`email` tinytext NOT NULL COMMENT 'Submitter email ',
`Comments` text NOT NULL,
`DATESTAMP` date DEFAULT NULL,
`IP` varchar(15) DEFAULT NULL,
`BROWSER` varchar(255) DEFAULT NULL,
`FORMID` varchar(255) DEFAULT NULL,
`SUBMIT` varchar(255) DEFAULT NULL,
`TIME` varchar(8) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
DATA DUMP
INSERT INTO `screaming_swift` (`Count_id`, `Location_id`, `Street`, `Survey_date`, `Survey_start_time`, `Count`, `Building_type`, `Building_age`, `email`, `Comments`, `DATESTAMP`, `IP`, `BROWSER`, `FORMID`, `SUBMIT`, `TIME`) VALUES
DATA
(7, 0, '', '0000-00-00', '00:00:00', 0, '', 0, '', '', '2025-05-04', '2a00
(8, 0, '', '0000-00-00', '00:00:00', 0, '', 0, '', '', '2025-05-04', '2a00