iam has an array of elements of type
[element1, itmem2, element3];
I need to insert these elements into a specific userId:
final results are as follows
UserId ItemId
2 || item1
2 || item2
2 || item3
currently iam cycles through the array in php code and inserts each element one at a time, for example
foreach($items as $item)
{
insert into items (UserId,ItemId) value (2,$item);
}
Is it possible that I can insert all the records in one query.
source
share