Current location: Hot Scripts Forums » Programming Languages » PHP » Flatfile question


Flatfile question

Reply
  #1 (permalink)  
Old 08-01-03, 10:10 PM
Agent Agent is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Flatfile question

Okay, here's what I have so far:

PHP Code:

$fp fopen("foo.txt""w");

// blah blah...
fclose($fp); 
Now, suppose I want to search within the file and look for a certain phrase/word. Would it be something like this?

PHP Code:

if( eregi("phrase"$fp) ) {

// blah blah

Supposing that works, would it be possible to take the "phrase" line and go 1 above or 1 below it? If I'm not making sense/it's not possible, then just hit me and I'll try again.
Reply With Quote
  #2 (permalink)  
Old 08-02-03, 01:12 AM
painperdu's Avatar
painperdu painperdu is offline
Baby Member
 
Join Date: Jun 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, it can be done.

-Read the file
-Put into an array
-Count lines of array
-Find line number string is on
-Send file pointer up or down from line number...

Check these sites out:
http://www.devshed.com/Server_Side/P...1_5/page1.html

http://us2.php.net/manual/en/ref.filesystem.php
__________________
.COM $8.75 / .INFO $3.25 / .MOBI $7.13 -FREE *Privacy Registrations - Dotbob.com
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl-PHP software Copyright question! kevin PHP 8 10-29-03 08:03 AM
Stupid question ( i think.. ) !!! Giullare ASP 2 10-01-03 02:21 AM
PHP header question khadlock PHP 2 09-23-03 08:17 AM
Off topic Question neworleans rookie The Lounge 4 09-06-03 11:19 AM
Web Stat Question ossi44 New Members & Introductions 2 06-13-03 09:36 AM


All times are GMT -5. The time now is 04:23 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.