I have an array which I need to insert into multiple rows of database. The structure of array is like:
$var = "Name1,Age1,DOB1,Relation1.Name2,Age2,Dob2,Relation2.";//And so on, depending on users input
(Dot indicates new line whereas Comma indicates new column) I need to insert it into database like this:
I first stored all rows in an array like:
$rowsToInsert = explode (".",$var);
I have now:
$rowsToInsert[0] = Name1,Age1,DOB1,Relation1;
$rowsToInsert[1] = Name2,Age2,DOB2,Relation2;
...And So on...
Problem:
What is the fastest way to store these array elements into database having Name, Age, DOB, Relation columns?