twofivethreetwo Posted November 15, 2007 Share Posted November 15, 2007 I have a sql row with this information: 11/12/07.10am.vs Lions|11/13/07.9am.vs Sharks|11/15/07.9am.Practice|11/16/07.10am.Practice|11/18/07.11am.vs Frogs| I need to explode the events and then explode the sections. So, basically I need to explode the | which separates the events. Then I need to explode . that separates each item in the event. How would this look? I have tried different things exploding and foreach and just haven't gotten it to work yet. The above basically needs to create a tables of events... Link to comment https://forums.phpfreaks.com/topic/77480-solved-explode-twice/ Share on other sites More sharing options...
pocobueno1388 Posted November 15, 2007 Share Posted November 15, 2007 Give this a try, I'm not sure exactly how you wanted it formatted, but I got everything into separate pieces for you. <?php $lines = "11/12/07.10am.vs Lions|11/13/07.9am.vs Sharks|11/15/07.9am.Practice|11/16/07.10am.Practice|11/18/07.11am.vs Frogs|"; $lines = explode('|', $lines); foreach ($lines as $line){ $line = explode('.', $line); echo "<b>Date:</b> $line[0]<br>"; echo "<b>Time:</b> $line[1]<br>"; echo "<b>Your Team</b> $line[2]<p>"; } ?> Link to comment https://forums.phpfreaks.com/topic/77480-solved-explode-twice/#findComment-392228 Share on other sites More sharing options...
twofivethreetwo Posted November 15, 2007 Author Share Posted November 15, 2007 Thats perfect. I can get it formatted and draw from the database... I was on the right path but just couldn't get it to work. That is perfect though, thanks for the help and quick reply. Link to comment https://forums.phpfreaks.com/topic/77480-solved-explode-twice/#findComment-392231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.