File line reader/jumper

They have: 6 posts

Joined: Feb 2006

Yea I already requested this code, but the file I had it in disappeared and so did the post that it was in earlier this week, so here it is...I need a script, that will read a file, find a certain combination of characters, in this case, the character will be "||" per line, and I need it to select the words before and after the "||" and set them into variables. I've read up plenty on google and php.net and such, but I can't find anything, so any help would be appreciated. O yea, the file is 'csv.txt'. But before it looks in each line for the "||" I want it to search for a number, that will be set as a variable, and go to that line. So that I can use the variables it declares for what business I need done, and then move on to the next line with that number.

She has: 31 posts

Joined: Jan 2006

I'm not too sure what you mean about selecting the number, would the number be on the first line of the file?

Assuming so, here's my approach.

<?php
$lines
= file('csv.txt'); // Open the file

$Which_Line=$lines[0]; // Select the number from the first line of the file

// Go to that line and print out each line after it.

for($x=$Which_Line; $x<count($lines); $x++){

$bits=explode('||',$lines[$x]);
$First_Part=$bits[0];
$Second_Part=$bits[0];

echo \
"Day {$x}'s Business part 1: $First_Part<br>
Day
{$x}'s Business part 2: $Second Part\";
}
?>

For a text file with the following:

2
Feed Cat||Walk Dog
Order Takeout||Take Over the World
Make pancakes||Kill the neighbour
Get Drunk||Fall Asleep

.. the script would print out:
Day 2's business part 1: Order Takeout
Day 2's business part 2: Take Over The World
Day 3's business part 1: Make Pancakes
Day 3's business part 2: Kill the neighbour
Day 4's business part 1: Get Drunk
Day 4's business part 2: Fall Asleep

Hope this helps.

They have: 6 posts

Joined: Feb 2006

The file is in the following format

Transaction#|MyID#|*This is the number I want it to jump to*|Date and Time of click|Clicks|I get paid this amount|Affiliate name||My Defined tracking #.

Incase you can't tell, this is an activity file that my merchant provides me.

They have: 6 posts

Joined: Feb 2006

Nevermind, I have been developing this code and it's doing what I want to, thanks for your help.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.