Reputation: 2682
I'm trying to add records to a MySQL table, but I keep getting a syntax error.
INSERT INTO `lwljhb_lwl_matches` (id, league_seasons_id, schedule_id, playoff_round, scheduled_week_number, date_played, winner_id, loser_id, forfeit, forfeit_reason, match_begin_time, match_end_time)
VALUES (,14,,0,1,2018-04-15,52,87,0,,'14:55:00','17:41:00');
The id column is autoincrementing, the match_begin_time and match_end_time fields are TIMEs. Can anyone point out my stupid mistake?
Upvotes: 0
Views: 26
Reputation: 85
If there's a column with no data you must put null
unless the column can't be null. this is your correct statemen
INSERT INTO `lwljhb_lwl_matches` (id, league_seasons_id, schedule_id, playoff_round, scheduled_week_number, date_played, winner_id, loser_id, forfeit, forfeit_reason, match_begin_time, match_end_time) VALUES (null,14,null,0,1,2018-04-15,52,87,0,null,'14:55:00','17:41:00');
Upvotes: 0
Reputation: 798686
You must specify something for all columns.
INSERT INTO `lwljhb_lwl_matches` (id, ...)
VALUES (NULL, ...)
Upvotes: 1