Insert Multiple Values into Table on Submit

QuestionsInsert Multiple Values into Table on Submit
Azhar Abdallah asked 2 years ago

Dear Abu Ghufran,

I have the a table which contains the following columns:
1. ID – AutoID
2. ClientID
3. CourierID
4. Date

What I'm looking for is how to insert multiple Data into Table at once.
Example:
I Fill:
clientID with: 2,3,4,7,9
CourierID: 1
Date: 3 Aug 2017

When I click submit, the data inserted into Table like this:
ID ClientID CourierID Date
1 2 1 3 Aug 2017
2 3 1 3 Aug 2017
3 4 1 3 Aug 2017
4 7 1 3 Aug 2017
5 9 1 3 Aug 2017
Its Like the Insert into Mysql statement:
INSERT INTO tableName
(column1,column2,column3,column4)
VALUES
('value1' , 'value2', 'value3','value4'),
('value1' , 'value2', 'value3','value4'),
('value1' , 'value2', 'value3','value4');

Is this scenario doable in phpgrid.

Looking forward to your reply.

Best regards,

Azhar

2 Answers
Abu Ghufran answered 2 years ago

Yes, thats doable with on_insert callback php function that allow your custom code to be executed instead of default insert.
You can iterate on POSTed client_id and run insert queries.

Refer http://phpgrid.org/docs > grid events

Azhar Abdallah answered 2 years ago

Dear Abu Ghufran,

Thank you for your continuous support.

It Works.

Regards,

Your Answer

5 + 10 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!