Jump to content


Photo

Fgets Question


  • Please log in to reply
1 reply to this topic

#1 ArnauDuran

ArnauDuran
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 June 2006 - 05:08 PM

Hello people,

I'm developing something in PHP and I have a question.

I have an archive named names.txt, with four lines:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Michael
Daniel
Jacques
David[/quote]

And I want to get a random name. I know how to open the file, and how to generate numbers, but, if, for example, I get number 3, I'd like the program to print 'Jacques', or if I get number 1, print 'Michael'.

So, with fgets, how can I read the line I want?

Many thanks, and I apologise for my english... :)

Greetings from Girona, Spain

#2 ArnauDuran

ArnauDuran
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 June 2006 - 09:48 AM

Well, I got it, thanks!

(I used explode() function)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users