SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Archieve Docs into Database then retreieve

    I have 100's of pdf file and word docs. I would like to put them into a table and then allow a link to open. I understand i need to store the links in a table. but how will i dynamically return a link and have it link to the actualy document? Any help would be great.

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No. yes. maybe.

  3. #3
    SitePoint Wizard
    Join Date
    Jan 2004
    Location
    3rd rock from the sun
    Posts
    1,005
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mbriggs
    I have 100's of pdf file and word docs. I would like to put them into a table and then allow a link to open.
    Do you mean a html table in a webpage? or do you mean store all the contents of the file a mysql table?

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no i know i you can't store the actual file in the database. but yo uhave the name of a file and the file has a home somepath/pdf_file and i guess you would let someone search for a doc lets say document number 23456, you would create a search page to search for a pdf and it would return a 23456 hyperlink to the file where ever it resides. My question is how do i do that and is that the most direct way to do it?

  5. #5
    SitePoint Wizard
    Join Date
    Jan 2004
    Location
    3rd rock from the sun
    Posts
    1,005
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mbriggs
    no i know i you can't store the actual file in the database.
    Well I think you can... turn it into binary.. people store images..

    but yo uhave the name of a file and the file has a home somepath/pdf_file and i guess you would let someone search for a doc lets say document number 23456, you would create a search page to search for a pdf and it would return a 23456 hyperlink to the file where ever it resides. My question is how do i do that and is that the most direct way to do it?
    Right, so you want to store filenames and presumably some meta-data about the file?

    Then you would need to create a table in mysql let say:
    Table: files
    ============
    file_ID INT auto_increment
    address VARCHAR 50
    doc_name VARCHAR 50
    author VARCHAR 50
    last_updated DATE
    description TEXT

    Then fill it in.

    So to follow your example:
    files
    ==========
    23456
    /files/myPdf.pdf
    "my dilemma"
    "Johanna Blogs"
    2005-01-01
    "How I overcame my fear of....."

    Then extract that into a webpage presumably into the TABLE you were originally on about.

    This is a simple example with one table, in effect you might have seperate tables for genres, authors, file types, etc etc.

    Thats why youd go to the trouble of using a database. Stick with it.

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much. You rock. So really i am taking each piece of data from the:

    23456
    /files/myPdf.pdf
    "my dilemma"
    "Johanna Blogs"
    2005-01-01
    "How I overcame my fear of....."

    so when i do my sql statement i do

    SELECT * from 'mytable' where doc = "$doc_number";


    in my return query also get the "/files/myPdf.pdf"(path)

    format in a table on my webpage with a <a href="$doc_number"."$path_variable" > then when they click the link it should open up the doc. Is this the right idea?

  7. #7
    SitePoint Wizard
    Join Date
    Jan 2004
    Location
    3rd rock from the sun
    Posts
    1,005
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably more like:

    <div>
    <a href="/$path_variable" title="$description_variable">$title_variable</a> - $date_variable
    </div>

    But now you can start to get clever ..

    Lets say you wanted to sort your tables of doc links by author:

    Simply you would write:
    'select * from files where author like "%bloggs%"';

    Now you can get the "latest 20 files", the "oldest 50 files", "the last 3 files by Johanna Bloggs".

    This is a very simplistic example of what a database is capable of doing for you.

    Now I could go on, and frequently do, but get that working with, say 20 files as an example, then explain more about what information you have about the files (meta-data if you like), their content etc and what you think your users will want, what will make life easy for them ? ... Good Luck.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •