How do I split this array and store into the database?
I have three fields in my model called Question_id, Answer_id and Phase_id.
I have a result like:
question_hash_string = "{\"5\":[\"5\",\"0\",\"\"],\"25\":[\"25\",\"1\",\"3\"]}"}
Which looks like {5:[5,0,1], 25:[25,1,3] ... }.
I want to split the array and store the results into the three fields in order Question, Answer and Phase of each set.
In my Batch table, I have three columns: question_id, answer_id and phase_id.
The first value of array[5,0,1], 5 goes to question_id, 0 to answer_id and 1 to phase_id. In the second row 25 to question_id, 1 to answer_id and 3 to phase_id.