Skip to content
Advertisement

Insert repeatedly from foreach loop

I have a problem I’m trying to insert data into a table except that I need to retrieve the id before

JavaScript

I want an insertion as many times as the loop returns the result.

thank you in advance

Advertisement

Answer

Why are you using a loop for something that SQL does natively? You should be using insert . . . select:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement