# PHP Wizards question (or referral to good bb)

**URL:** <https://boards.straightdope.com/t/php-wizards-question-or-referral-to-good-bb/516906>\
**Category:** Factual Questions\
**Created:** [November 9, 2009, 4:07pm UTC](https://boards.straightdope.com/t/php-wizards-question-or-referral-to-good-bb/516906 "2009-11-09T16:07:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpine](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/alpine/32/17813_2.png) [@Alpine](https://boards.straightdope.com/u/Alpine)\
**Post date:** [November 9, 2009, 4:07pm UTC](https://boards.straightdope.com/t/php-wizards-question-or-referral-to-good-bb/516906/1 "2009-11-09T16:07:33Z")

</div>

I am new to PHP/MYSQL. I’ve set up a simple content management system which stores a little info about, and URLs to, pdf files in directories. Now I want to do a one-time bulk update where I don’t have to enter the info for each file through the CMS. I would appreciate any help or a recommendation for a good php bulletin board where I can post my question.

Basically, I want to loop through a home directory which has a number of subdirectories, loop through the file names within each subdirectory and load those base file names into an existing database. I think I use the readdr function to get the file names, but I’m not sure about the basic mechanics.

(Then I will parse out the file names into other fields using mysql. The file names include a date, such as 20090515, so I think I can inject that pretty easily into my date field and create the URLs at the same time.)

Again, any help or a referral would be great!

---

<div class="post-metadata">

**Author:** ![Alpine](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/alpine/32/17813_2.png) [@Alpine](https://boards.straightdope.com/u/Alpine)\
**Post date:** [November 9, 2009, 8:54pm UTC](https://boards.straightdope.com/t/php-wizards-question-or-referral-to-good-bb/516906/2 "2009-11-09T20:54:37Z")

</div>

Okay, I figured it out. Turned out to be two rounds of readdir functions, one for the subdirectories into an array, and then a for each loop with a nested readdir function for the file names spitting out to a second array. I could then perform an sql INSERT on that array.

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [November 9, 2009, 8:57pm UTC](https://boards.straightdope.com/t/php-wizards-question-or-referral-to-good-bb/516906/3 "2009-11-09T20:57:55Z")

</div>

My new favorite site for programming questions is [Stack Overflow](http://www.stackoverflow.com/).

---

<div class="post-metadata">

**Author:** ![Alpine](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/alpine/32/17813_2.png) [@Alpine](https://boards.straightdope.com/u/Alpine)\
**Post date:** [November 10, 2009, 3:10am UTC](https://boards.straightdope.com/t/php-wizards-question-or-referral-to-good-bb/516906/4 "2009-11-10T03:10:38Z")

</div>

Thanks, **friedo**. I’ll check that out.
