You have after the SQL script for the table and the PHP script I use.
Best regards,
Richard
I created the following table :
CREATE TABLE IF NOT EXISTS `TEACHINGS` ( `teaching_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(60) NOT NULL, `location` varchar(50) NOT NULL, `teaching_date` date NOT NULL, `description` text NOT NULL, `opening_hours` varchar(10) NOT NULL, UNIQUE KEY `TEACHING_ID` (`teaching_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=24 ;
Maybe you would want to try wrapping the INSERT query call into a try{} catch{} block. You could emit some kind of message as you run the query (perhaps print the query string) to see where the logic is making the second INSERT.
Just guessing, but it looks like this may be part of the issue:
The 2 solutions selected are useful but I can select only one, what a shame.
Chris and Ray gave me solutions for 2 distinct issues, and Ray gave me full insight about the issue.
Just guessing, but it looks like this may be part of the issue:
Open in new window
If $action is NOT "g" it looks like the script will try to run the INSERT query - no matter what is present in the POST array.