Answer the question
In order to leave comments, you need to log in
How to INSERT data into a table with autoincrement?
Need to insert data into wp_options table
INSERT INTO `wp_options` (` option_id `, `option_name`, `option_value`, `autoload`) VALUES
( 1 , '__plugins_cache_244', 'test1', 'no'),
( 2 , '_cache ', 'test2', 'no'),
( 3 , 'hello', 'a:2:{s:2:\"lk\";s:2:\"-\";s:2:\" uk\";s:3:\"API\";}', 'yes');
This table already has option_id 1,2,3 how to insert so that option_id equals the last ID in the table, but plus 1, i.e. if the table has the last entry with option_id = 450, then insert these three rows with option_id 451, 452 , 453
Answer the question
In order to leave comments, you need to log in
Either omit the option_id column, or use DEFAULT instead of a value:
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES
( '__plugins_cache_244', 'test1', 'no')
...
INSERT INTO `wp_options` (`option_id`, `option_name`, `option_value`, `autoload`) VALUES
(DEFAULT, '__plugins_cache_244', 'test1', 'no')
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question