Whats up all. I need some help here. I’m designing a mySQL database for this website I’m doing. The whole site will be dynamic, of course making it easy to update via control panel system.
The website is pretty small so far. I narrowed it down to 5 sections, each section having sub categories. I created a real basic flowchart of how the structure will be.
The thing thats somewhat concerning me is the sub sections. I never really had subsections to anysites I did. Once I did a while back and to be honest i think I structured the database incorrecty.
My thaughts are to have 5 tables lets say for the content.
Home
About
Services
Clients
Contact
No im guessing I should have another table with all the sub categories and link the ID’s together.
1st problem: How do I make a relationship in mySQL? I’ve never used mySQL like this, only for basic stuff.
2nd problem: Something is telling me that this sin’t the best way to approach this.
I’m hoping someone will be able to lead me into the right direction with this, as I lack in experience with not only mySQL but generating an entire sites content , especially a site with sub categories.
Eh, my take on it is “Set it up however you feel most comfortable.” If it works for you then it works for me. If the user can see the content and it doesn’t take a million years to load then you’re golden. The only time database structure really comes into play is when you are storing large amounts of data (like a forum, or news site) and you’re thinking about performance and load times, but if its just a site with 5-20 pages of content that you want kept in a database, then you can make it however you dam**n well please…
Not sure if you are familair with MS Access but you can create a relatonship between tables. How can I do this with mySQL? Will this be in my phpmyAdmin section?
you can get them used for under $20 from Amazon.com…
oh and about the relationship between tables, yes its possible, but I haven’t worked with it yet because none of my projects have really needed it… But yea its possible. I’ll try to find something for you… check out those books. Definatly the best there is…
thanks jubrock, i have a decent book over here “PHP and MySQL Web Development” that i borrowed from a friend this afternoon that i can use for now, hope it helps.
*Originally posted by TOOL *
**For the relationship between tables, use a foreign key in the sub categories table to link the ID back to the main table’s ID.
hmmm… this is interesting… i was about to post a similar topic… i am making a CMS too…
my database design is like this:
currently, i have 5 pages… but then, what if i want to add more? to be able to do this without changing the code of the script, i placed all my “pages-link” in a Main table that contains all the pages…
the main table has these fields: (called PAGE_TABLE)
PAGE_ID --> auto-increment thing…
PAGE_DESC -->a description
PAGE_SQLTABLE --> this will be the link to the table for each page
PAGE_NAME --> name of the table to be linked
so when i add a page, i just Insert it on PAGE_TABLE and then create a new table with it named $table_sqltable…
so when i link to the new page, i just do something like this: http://www.mysite.com/index.php?target=table_name… in the sql, i would do something like: WHERE $table_name=PAGE_NAME when it finds a match, it connects to the table using PAGE_SQLTABLE and then queries the content of that table…
i know this is not the best way to do it… but it works for me…
i’d be glad to share my code after im done with it… right now, im making something that will allow the user to upload files (images/zip)…
*Originally posted by sinus_ * but it gets very confusing
THe whole point is to make it so that its not confusing. Basically when you set something like this up you want to think about the possibility of someone else taking over your work. Would they be able to easily figure out what you were doing and how to change your work around?
its not much… but it seems to work for me… and for future sites…
no Word-like GUI though… i wonder how they do that… like the ones in Yahoo mail… the things they do with the textarea… make text bold, insert images, and best of all, Tables… downside to the script i made is that you have to edit in HTML… using a textarea…
its not much… but it seems to work for me… and for future sites…
no Word-like GUI though… i wonder how they do that… like the ones in Yahoo mail… the things they do with the textarea… make text bold, insert images, and best of all, Tables… downside to the script i made is that you have to edit in HTML… using a textarea… **
so what your doing is keeping the sub sections of about let’s say in the about table? thats basically how i was going to do it but it just doesn’t seem the best way to do it.
I do the same thing. Basically for each section of the site I make a new table and keep all my data for that section in that table. Its all preference but thats usually the best way to keep the data organized…