FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Going back to a previous line in a CSV file
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Going back to a previous line in a CSV file [message #170160 is a reply to message #170143] Wed, 13 October 2010 13:39 Go to previous message
aaaa is currently offline  aaaa
Messages: 7
Registered: September 2010
Karma:
Junior Member
> Hello, how do I go about doing this.
>
> I've tried using fseek but it doesn't work

It does work, but you need offset.
You should use fgetcsv, if you do then:

$f = fopen(...)

while(...)
{
$line = fgetcsv($f);
//going back:
$cur_pos = ftell($f); //remember current pos
fseek($f, $pos, SEEK_SET); //go to previously remembered position
$prev_line = fgetcsv($f); //read line
fseek($f, $cur_pos, SEEK_SET); //go to "current" position
//end of going back
$pos = $cur_pos;
}


--
A
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to Hide browser status bar Message from client
Next Topic: Mesothelioma
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 06:55:08 GMT 2024

Total time taken to generate the page: 0.04245 seconds