Re: Opening Multiple Files
| From: | Alex Nikitin | Date: | Wed, 07 Sep 2011 14:28:23 +0000 |
| Subject: | Re: Opening Multiple Files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314738@lists.php.net to get a copy of this message | ||
On Wed, Sep 7, 2011 at 10:21 AM, Ron Piggott <ron.piggott@actsministries.org
> wrote:
>
> Hi Everyone
>
> I am trying to load an HTML book into mySQL. The book was distributed with
> each chapter being it’s own HTML file.
>
> The only way I know how to open a file is by specifying the file name.
> Such as:
>
> $myFile = "B01C001.htm";
> $lines = file($myFile);
> foreach ($lines as $line_num => $theData) {
>
> Is there a way PHP will open each file in the directory ending in “.htm”,
> one file at a time, without me specifying the file name?
>
> When the file is open I need the FOREACH (above) to parse the content which
> ends with an “INSERT INTO” for a mySQL table.
>
> Thank you in advance for any help you are able to give me.
>
> Ron
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info
>
opendir/closedir and readdir/rewinddir functions come to mind, you can
easily iterate through files in a directory that way...
--
The trouble with programmers is that you can never tell what a programmer is
doing until it’s too late. ~Seymour Cray