svh1 Posted April 4, 2007 Share Posted April 4, 2007 Hello, I need to build a parser that dumps the data into a MySQL database and I'm hoping someone out there will be kind enough to guide me through this. My data comes to me via a .txt format and is pipe delimited. Here's a snippet of the data: |58196|0206|Lube & tire work. F/T. Bilingual a plus. Apply at Elliott Tire |40008295| |57719|0206|Heavy Equipment Mechanic needed North end. (123)555-5555|40020937| The really tricky thing is that I need the first and last columns to be removed completely. I also need the second column (the 0206) to be converted to a name based on the number. In this example the 0206 would be renamed to 'Mechanical'. Any help would be GREATLY appreciated! Link to comment https://forums.phpfreaks.com/topic/45632-datafeed-parser/ Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 Just use explode to turn each line into an array. Link to comment https://forums.phpfreaks.com/topic/45632-datafeed-parser/#findComment-221613 Share on other sites More sharing options...
svh1 Posted April 4, 2007 Author Share Posted April 4, 2007 I was hoping for some sample code to at least get me going. Yeah, I know, "stupid n00bs!" but hey, this is a help forum, right? Link to comment https://forums.phpfreaks.com/topic/45632-datafeed-parser/#findComment-221617 Share on other sites More sharing options...
trq Posted April 4, 2007 Share Posted April 4, 2007 This should give you the idea. <?php $s = "|58196|0206|Lube & tire work. F/T. Bilingual a plus. Apply at Elliott Tire |40008295|"; $a = explode('|',$s); foreach ($a as $v) { echo $v."\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/45632-datafeed-parser/#findComment-221621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.