Page 1 of 1

script to insert all files from directory into db

Posted: Wed Jul 09, 2008 8:41 am
by phpuppy
Hello all,

I've been looking around for a while at scandir and other php functions for a way to insert all files in a given directory into a table and can't seem to get it. The files would have a sequential order like 1.jpg, 2.jpg, 3.jpg, etc.

Can someone give a link on a tutorial or, better yet, the script on how to do it?

Thanks!
phpuppy

PHP 5.2.5 - MySQL 5.0.45

Re: script to insert all files from directory into db

Posted: Wed Jul 09, 2008 12:22 pm
by jayshields
If you read the example on http://uk3.php.net/opendir it will give you a starting point for iterating over a directory of files.

Also the examples on http://uk2.php.net/mysql_query will probably help.

Re: script to insert all files from directory into db

Posted: Thu Jul 10, 2008 8:34 am
by phpuppy
Gee, thanks, a link back to the manual... how helpful.