1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

pictures in mysql databases

Discussion in 'Linux and Unix' started by CharlieMouse, Oct 7, 2003.

Thread Status:
Not open for further replies.
  1. CharlieMouse

    CharlieMouse Thread Starter

    Joined:
    Jun 13, 2003
    Messages:
    148
    Hey

    I'd like to create a web driven website that uses mysql and php.
    I neef ot find a way to be able to let a websurfer search my site for pictures. ex.

    I got a ton of pictures of cars, I like them to be able to select form a pull down menu a year than a model and use the webserver display the list of pictures in the form of a table.


    I have been working with Mysql for a while and the thing I need most is advice on how to set up the database, what should be in each field, and how to search a DB though a website.

    I know the basic commands. I understand to display the results from a search(a little bit). I need a sample code of a DB and Php.
    once I know how to start it out, I can go from there

    charlie
     
  2. evilmrhenry

    evilmrhenry

    Joined:
    Dec 14, 2001
    Messages:
    105
    (FYI, I'm not all that good at databases, so take this with a grain of salt.)

    There are a few ways to do this. The following may not be the best, depending on the data used, but it should work:

    For the table, the basic method would be to index by filename, (consider keeping it descriptive, through name or directory, in order to aid crash recovery) then include search terms. The details would depend on the categories you have. If all you have are cars, and aren't planning on adding anything more, then just fields of 'model', 'year', and whatever else could work. If you have a few more categories, then consider having:
    Code:
    'filename', 'main_cat', 'sub_cat1', 'sub_cat2' . . .
    where each sub_cat corresponds with a subdirectory.

    This works well if the data can be placed in a hierarchy. If you want a more flexible solution, try this:
    Code:
    'filename', 'search_term'
    Here, the primary key would either be an unused number, or a composite key made from the two fields. Here, to search, a term is entered, and all rows with that as the 'search_term' are returned. Obviously, each file will take up more than one row. Another table could be created to give non-search data. For example:
    Code:
    'filename', 'file_ext', 'file_width', 'file_height', 'file_copyright'
    Without knowing the variety of data, it is hard to give an optimal solution. However, one of these might work.
     
  3. CharlieMouse

    CharlieMouse Thread Starter

    Joined:
    Jun 13, 2003
    Messages:
    148
    thanks

    I brought a book on php and mysql I had no Idea Php was that usefull, Its like wow, I already wished I would have knowned this years ago, Its using code helps save writing html, like includes, and loops, etc. I am sure I will find a way using php to search mysql, as for the format of the datbase itself I thing your wright, I'll give that a try.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - pictures mysql databases
  1. angelo.dealwis
    Replies:
    3
    Views:
    191
  2. AmritMatti
    Replies:
    2
    Views:
    254
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/170094

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice