- Joined
- Jul 23, 2012
- Messages
- 201
- Reaction score
- 131
Hello, i will start with basic introduction, lol, so i am storing data in database array items as string for example,
Table example
ID | NAME | ARRAY_STRINGS
ID = 1
NAME = something
1.ARRAY_STRINGS = MyItem,MyItem2
it can get more complicated like this
2.ARRAY_STRINGS = MyKey:MyItem,MyKey2:MyItem2
3.ARRAY_STRINGS = MyKey:MyItem,MyKey2:MyItem2,MyITem3
4.ARRAY_STRINGS = MyKey:MyItem
5.ARRAY_STRINGS = MyItem
and so on, so example would be converted to
then these arrays are cached to php file and saved for latter usage.. the php code:
[paste]dHfajpPv[/paste]
So is there any suggestion to improve this code, because at one point i go 4 loops deep, so there is an design error in the code, idk if the code is working i write it on the fly, i just need some pointers, thanks
EDIT
Solved this, found good article on this subject, can be closed
Table example
ID | NAME | ARRAY_STRINGS
ID = 1
NAME = something
1.ARRAY_STRINGS = MyItem,MyItem2
it can get more complicated like this
2.ARRAY_STRINGS = MyKey:MyItem,MyKey2:MyItem2
3.ARRAY_STRINGS = MyKey:MyItem,MyKey2:MyItem2,MyITem3
4.ARRAY_STRINGS = MyKey:MyItem
5.ARRAY_STRINGS = MyItem
and so on, so example would be converted to
PHP:
1. array(MyItem,MyItem2);
2. array(MyKey=>MyItem,MyKey2=>MyItem2);
3. array(MyKey=>MyItem,MyKey2=>MyItem2,MyITem3=>MyITem3);
4. array(MyKey=>MyItem);
5. array(MyItem);
then these arrays are cached to php file and saved for latter usage.. the php code:
[paste]dHfajpPv[/paste]
So is there any suggestion to improve this code, because at one point i go 4 loops deep, so there is an design error in the code, idk if the code is working i write it on the fly, i just need some pointers, thanks
EDIT
Solved this, found good article on this subject, can be closed
Last edited:

