Welcome our webmaster and SEO forum
Please enjoy the forum, contribute what you can, and wind up the Moderators!
Closed Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Plan a SQL database with pictures etc

  1. #1
    lala is offline Senior Member lala is on a distinguished road
    Join Date
    Feb 2007
    Posts
    145

    Default Plan a SQL database with pictures etc

    Is there any "clever" way for planning the stucture of your database. I know you should avoid redundant data as much as you can and kind of cross-reference related items in different tables. But is there any good way of forecasting how future requirements might look like in order to avoid a complete re-structuring of you database?

    Also, I always wondered how you store pictures in a SQL database.

    lala

  2. #2
    melkior_inactive Guest

    Default

    Well, the best way to design the DB is to get all the data you will be using on a paper.
    When I create web apps, the first thing I do is design the database. I find it easier to develop the application when I have a data overview. Then I know what functions I'll need and what parts the app will have.
    I lay out all the data I'll be using and manipulating and try to organise it in tables the best way I can. I sometimes draw dataflows and workflows to get the a better view of what I'm actually doing.
    Basic structure would be users table, products table, other tables.
    I like keeping the settings in files, not in the database.
    So if I want the images for products, I'd add a column in the products table and name it images, or something.
    To store images, you use BLOB.
    It's a datatype - Binary Large Object.
    Now, it's usually recommended not to store images in the DB, but I'm running a site that had 13GB (not a mistake, it's gigabytes) of pics stored in BLOBs so you shouldn't have any problems.
    If you need more help, post more specific questions and I'll see what I can do.
    If you want to avoid storing images in the DB, you could upload them to a folder, and store the path to the pics in the DB instead.

  3. #3
    ForumJoiner is offline Member ForumJoiner is on a distinguished road
    Join Date
    Mar 2007
    Posts
    50

    Default

    Quote Originally Posted by melkior View Post
    I'm running a site that had 13GB
    If you don't mind, what web host allows you a database of 13 GB? Or, do you have your own server? I'm asking this because, in the future, I might need a huge database.

  4. #4
    ForumJoiner is offline Member ForumJoiner is on a distinguished road
    Join Date
    Mar 2007
    Posts
    50

    Default

    Quote Originally Posted by lala View Post
    I know you should avoid redundant data as much as you can and kind of cross-reference related items in different tables.
    If you are asking also how to avoid redundancy, I believe this article might be a starting point:
    Database normalization - Wikipedia, the free encyclopedia

  5. #5
    melkior_inactive Guest

    Default

    Quote Originally Posted by ForumJoiner View Post
    If you don't mind, what web host allows you a database of 13 GB? Or, do you have your own server? I'm asking this because, in the future, I might need a huge database.
    It's a dedicated server. Talk to Temi for more info.

  6. #6
    UK WW ex member is offline Senior Member UK WW ex member is on a distinguished road
    Join Date
    Jan 2007
    Posts
    161

    Default

    No clever way needed. Follow the principles of designin database . Normalization is a database concept to avoid redunancy . Read about database normalization it will help . yes Blob data type will allow you to store image in the database

  7. #7
    lala is offline Senior Member lala is on a distinguished road
    Join Date
    Feb 2007
    Posts
    145

    Default

    Thanks to all of you You have been very helpfu.

    I will start my project in due course and might come up with some more questions (if you do not mind)...I am very glad that it is possible to store pics in the database. Or, do you think it would be more efficient to store the path? What would be the preference?

    Sorry, I did not come back to you earlier. My son was terribly ill, so I was a "24/7-nurse" with no time for my projects...Actually, any time I do not get back immediately to you guys this is usually related to some sort of a 2-year old disaster

    lala

  8. #8
    melkior_inactive Guest

    Default

    If you're planning to have more than 1GB of pictures in the database, store paths only. If less, you can store the pics directly in the DB.
    And no problem if you have more questions. Glad to help ya!

    And I'm glad you're son is better.

  9. #9
    lala is offline Senior Member lala is on a distinguished road
    Join Date
    Feb 2007
    Posts
    145

    Default

    Thank you Melkior

    Actually, I have few other questions related to the same project, which is a website for a friend's furniture business: At the left side we would like to have the navigation for the furniture categories. We would like to have them categorisied by range and also underneath by room.

    For that purpose would it be sufficient to have a column with range and another one with room in the product table of the SQL database? The navigation bar should take the values, which are stored for range and room in the database (obviously only once). On top of that the main page's content should update accordingly (range or room overview pages will have pics with name underneath of ranges or possible items in room).

    Where I do not get my head around is especially if it is possible to have one PHP file for the range or room overview, one for a choosen range or room and one for the choosen item, which update themselves accodingly to what the user clicked on (to save me from hard-coding files for each possible combination or product, for example 50 item pages if we would have 50 products).

    I am very new to PHP. Have actually only read a book about it without doing much with it yet. Really eager to get the grip on it, but will certainly pose some really basic questions. I hope you do not mind...

    lala

  10. #10
    melkior_inactive Guest

    Default

    Quote Originally Posted by lala View Post
    Thank you Melkior

    Actually, I have few other questions related to the same project, which is a website for a friend's furniture business: At the left side we would like to have the navigation for the furniture categories. We would like to have them categorisied by range and also underneath by room.
    OK, fair enough. That doesn't seem to complicated, so I'm with ya so far.

    Quote Originally Posted by lala View Post
    For that purpose would it be sufficient to have a column with range and another one with room in the product table of the SQL database? The navigation bar should take the values, which are stored for range and room in the database (obviously only once). On top of that the main page's content should update accordingly (range or room overview pages will have pics with name underneath of ranges or possible items in room).
    Yes, those 2 columns should be enough. If your SELECTs are written properly the page will update itself accordingly every time it's opened.

    Quote Originally Posted by lala View Post
    Where I do not get my head around is especially if it is possible to have one PHP file for the range or room overview, one for a choosen range or room and one for the choosen item, which update themselves accodingly to what the user clicked on (to save me from hard-coding files for each possible combination or product, for example 50 item pages if we would have 50 products).
    No, you don't need to create hundreds of pages. (You could of course, but that kills the whole purpose of PHP, and it's a little bit masochistic )
    What you do is load all external files through index.php
    For instance if you have 3 files (let's put them in the includes/ sub folder) you need to send them using the GET method.
    So it would look like (if the names of the files are room.php, range.php, item.php) index.php?query=room or index.php?query=item
    and to get to a specific item or room or whatever the adress would look like index.php?query=room&id=bedroom
    That would list the furniture available for the bedroom.
    So the SQL select would look something like:
    PHP Code:
    SELECT from products WHERE room="$room
    A specific item would be something like:
    index.php?query=item&id=37
    So that would retrieve an item that has the ID 37. This would be the theoretical select.
    PHP Code:
    SELECT from products WHERE id="$id
    Quote Originally Posted by lala View Post
    I am very new to PHP. Have actually only read a book about it without doing much with it yet. Really eager to get the grip on it, but will certainly pose some really basic questions. I hope you do not mind...

    lala
    PHP is fairly easy. Once you get the logic and the basic idea you can always look up the correct syntax on the internet.
    I haven't read a book on PHP in my life. I just took a few applications apart, to get the basic idea and logic and started writing my own apps.

Closed Thread
Page 1 of 2 1 2 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Pictures do not upload
    By Piotrek in forum FAQs
    Replies: 4
    Last Post: 10-15-2007, 09:16 PM
  2. Professional Web design Services (PICTURES INCLUDED)
    By superstar4410 in forum Marketplace (all other buy/sell/wanted)
    Replies: 0
    Last Post: 03-24-2006, 03:29 AM
  3. Pictures from GooglePlex (London)
    By ovi in forum General Webmaster Talk
    Replies: 2
    Last Post: 11-25-2005, 06:17 AM
  4. Linux, in pictures.
    By Alexandru Ungur in forum Computer and Software Forum
    Replies: 1
    Last Post: 02-20-2005, 06:29 PM
  5. Free pictures, where ?
    By criserb1 in forum General Webmaster Talk
    Replies: 8
    Last Post: 10-29-2004, 04:23 PM

Bookmarks

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

Search Engine Friendly URLs by vBSEO 3.6.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124