Splitting a string and sql insert as array?

learning_brain

New Member
Messages
206
Reaction score
1
Points
0
Splitting a string, based on " " is fairly simple, but how do I store it to a longtext field as an array?

I need to store a) the string part and b) the order within that string.

I also then need to be able to call any part of that array from the DB.

Any ideas?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
The relational model for a sequence is to store the position within the sequence along with the items at that position. With multiple sequences stored in the same table, you'd also have an identifier for the sequence. Depending on your needs, it might make more sense to store the entire sequence in a single column, as lemon-tree suggests.
 

learning_brain

New Member
Messages
206
Reaction score
1
Points
0
Thanks. This is perfect. After looking through the Serialize details, I have also been able to add multi-dimensional arrays, which I think I'm going to need.

My only issue now is to add post data to each part of the 1st layer array.... Figuring that out now.
 
Top