Kemik Posted August 2, 2007 Share Posted August 2, 2007 Hello all, I'm making a table called "tournament_config". It will have the following: fid = int(11) auto_inc, primary key clanh = int(11) clana = int(11) map = varchar (225) timestamp = int(11) I want to make a list of maps. E.g. map1, map2, map3, map4. That I can pull from the database and split up. E.g. In week one clans will play map1, in week two clans can play map3. Will I be able to pull that array and break down the maps so I can do this? E.g. $map = $result['map']; Then $map[week1] would = map1. Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/63070-solved-pulling-an-array/ Share on other sites More sharing options...
DeepakJ Posted August 2, 2007 Share Posted August 2, 2007 Can you try and make it clearer I cant really see what you are trying to do? Link to comment https://forums.phpfreaks.com/topic/63070-solved-pulling-an-array/#findComment-314108 Share on other sites More sharing options...
Kemik Posted August 2, 2007 Author Share Posted August 2, 2007 Here's an example. In my table I have inserted: tid: 1 name: My Tournament max_clans: 32 maps: de_dust, de_dust2, de_aztec, cs_assault, cs_office Timestamp: 02/08/2007 I want to pull "maps" aka "de_dust, de_dust2, de_aztec, cs_assault, cs_office" from my database table and put them in to an array. Then I can use the array and call the maps inside. E.g. $map[week1] = de_dust, $map[week2] = $de_dust2. How do I turn "maps" in to an array? Each tournament might have a different number of maps, otherwise I would have just made a column for each map, instead of calling it maps. Link to comment https://forums.phpfreaks.com/topic/63070-solved-pulling-an-array/#findComment-314119 Share on other sites More sharing options...
akitchin Posted August 2, 2007 Share Posted August 2, 2007 you can explode the entry using the comma, which will feed it into an array: $maps = explode(', ', $result['maps']); print_r($maps); you'll need to work out the keys on your own, but i'm sure you're capable of that. Link to comment https://forums.phpfreaks.com/topic/63070-solved-pulling-an-array/#findComment-314123 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.