Insert multiple rows from a form into DB
-
I had a table in a form with multiple rows.On click of submit, I made an ajax call( data: $(‘#uiWishList’).serialize()) to insertDB.php which has a query to insert into DB. For now the hardcoded query looks like: $wpdb->query(“INSERT INTO ui_development_tools_wishlist
(ShortName, Category, Purpose, Necessity)
VALUES
(‘$amount’, ‘val1’, ‘erwd’, ‘user1’),
(‘name2’, ‘val2’, ‘erwd’, ‘user2’),
(‘name3’, ‘val3’, ‘erwd’, ‘user3’)”);
1. How can I modify the query such that it inserts dynamic values received from the AJAX.
2. How to get success/failure message after inserting into DB.
The topic ‘Insert multiple rows from a form into DB’ is closed to new replies.