DanC Posted November 11, 2009 Share Posted November 11, 2009 Hi, Simple question. I have a column called "array" in my database, and inserted into each field is the following imploded array: mctriangle,570.65,355.1,1,1,0 It is an instance of an object. Each field in each row contains this information as an imploded array. [0] = Name [1] = X Axis [2] = Y Axis [3] = ScaleX [4] = ScaleY [5] = Rotation When extracted from the database, it is exploded back into the array above. As you can see, I would need to store a lot of rows for each object. Say we use 200 objects, thats 200 rows, which would be hard to search through. My question is: Could I store multiple imploded arrays inside 1 row only. E.g: mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0&&mctriangle,570.65,355.1,1,1,0 The above would be 5 objects in one row of data, each imploded array separated by &&. How would I go about doing such a thing? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/181055-solved-multiple-arrays-inside-data/ Share on other sites More sharing options...
mikesta707 Posted November 11, 2009 Share Posted November 11, 2009 well firstly, you should look into serialize() if you want to put data structures (arrays, objects, etc) into tables. However, if you feel the need to put multiple different objects in one column, I suggest you rethink your database structure. However, i suppose all you would need to do is do something like $string = implode(',',$array1)."&&".implode(',', $array2); Quote Link to comment https://forums.phpfreaks.com/topic/181055-solved-multiple-arrays-inside-data/#findComment-955317 Share on other sites More sharing options...
DanC Posted November 11, 2009 Author Share Posted November 11, 2009 Hi, Thanks for the quick reply. This is exactly what I was looking for. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/181055-solved-multiple-arrays-inside-data/#findComment-955337 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.