LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-14-2008, 02:48 PM   #1
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Rep: Reputation: 16
PHP: saving the name of each file in a directory in a database?


Is it possible to save the name of all the files in a directory in a database. So that each file has its own row in a table?

If it can be done, how can i do this?
 
Old 04-14-2008, 03:37 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,520

Rep: Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944
Very possible. Check here:

http://us3.php.net/readdir

That will give you some good direction to read the file names in a given directory. From there, check this out:

http://us3.php.net/manual/en/functio...-insert-id.php

Which will give you basic syntax to insert a record into a MySQL database. You didn't say what kind of database you were using, but at least this will give you a starting point.
 
Old 04-17-2008, 10:28 AM   #3
konqi
Member
 
Registered: Oct 2007
Distribution: Gentoo, Slackware
Posts: 162

Original Poster
Rep: Reputation: 16
thanks, it worked
 
Old 04-17-2008, 10:42 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,520

Rep: Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944Reputation: 7944
No problem...glad to be of help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP include file directory/paths DMeerholz Linux - Software 1 07-02-2007 10:21 AM
How to stop thumbnail directory from saving pics? M$ISBS Linux - Newbie 8 01-30-2007 11:43 AM
PHP5 on Apache saving .php files Skip-DMP Linux - Enterprise 2 08-03-2006 08:25 AM
need to get data from xml file to MySQL database, and then use php to access Armon Linux - General 1 01-18-2006 02:54 PM
Saving gcc output files to new directory Fe98 Programming 3 12-08-2003 07:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration