![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Mar 2007
Posts: 922
|
SQL structure [no trolls allowed]
I want to try to get it right the first time so I don't have to pull my hair out later. If you were storing FHGs, Model Information, Sponsor Information, etc in a relational database.... how would YOU set up the structure of these tables? I'm thinking something like:
main table - galleryID, sponsorID, modelID then gallery table - galleryID, category, number, type, dateAdded, any other information about the GALLERY sponsor table - sponsorID, sponsorName, 2257custodianContact, siteURL, other info about each SPONSOR model table - modelID, site, niche, hair color, blah, blah, blah about each MODEL (Yeah I know it's a crappy structure. This will be my first database, I am showing an example and asking your opinion) 2 simple questions for each poster:
Thanks every1
__________________
Vote Bill Cosby 2012 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Sofa King Band
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
|
Yup, that's how you do it.
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Oct 2006
Posts: 749
|
It doesnt look terrible, but you need at least two more tables:
a category table for gallery a niche table for models and possibly a lookup table for niche In any case whereever you'll have something that isn't unique among every record, you should store that information externally. 'niche' is a perfect example of this. You might end up with 100 chicks with big tits. if you eventually end up changing the term "Big Tits" to "Busty", you'll have to make that change in each record. I recommend you also have a lookup table for niche, so that your models can have multiple niches. Imagine having a busty redhead. You can use that information to cater to freaks like me who go insane for big tits and red hair.
__________________
Deranged World |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Join Date: Mar 2007
Posts: 922
|
oh yes and another question. I am limited to approximately 7.5 million SQL queries each month on my virtual host. Would it then, be a bad idea to query the databases several times per user? I'm thinking that might ad up to a lot very quickly.
Quote:
![]()
__________________
Vote Bill Cosby 2012 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Join Date: Oct 2006
Posts: 749
|
Quote:
You should also look into caching. If, for example, a gallery never changes once it is published, it makes no sense to make constant trips to the datbase on every page view. You can cache parts of pages, too. So for example lets say you have a gallery (that never changes) and then a bunch of link exchange shit elsewhere on the page, you can cache the gallery part and still grab the link exchange results from the DB. I was thinking more along the lines of Bettie Ballhaus, but that'll do! ![]() ![]()
__________________
Deranged World |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Jul 2004
Location: The Beach
Posts: 4,626
|
I would put a foreign key from sponsor to the gallery table so that you at least know which sponsor the gallery belongs to....
also I don't know how you are going to use it but if it was me and the sites from the sponsors were relevant I would maybe make two tables for that programs - id int 11, name varchar(250), login_url varchar(250), ref_url varchar(250), desc text. sites - id int(11), program_id int(11), name varchar(250), url varchar(250). and then on your gallery table I would add a column called site_id int (11). Maybe you want some relations to the model as well from your gallery and that is done the same way with adding a model_id field with the id of the model from the models table ![]() Good Luck you are on the right track mr
__________________
ICQ# 143561781 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Mar 2007
Posts: 922
|
ah yes I was planning on relating the site to the sponsor, and the model to the site and/or sponsor as well.
@ schneemann : if you check out the page and refresh it, the images shuffle. Currently it's a flat file and $array = file($filename) then shuffle($array) etc. I suppose I could query once on the page load, and send the information in a javascript array packaged with the code required to shuffle it client side... but I am sort of attached to the 3.67% of my surfers that don't have javascript enabled. *sigh* ![]()
__________________
Vote Bill Cosby 2012 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Confirmed User
Join Date: Oct 2006
Posts: 749
|
Quote:
You might want to check into a host that doesn't limit your queries. It wouldn't hurt to figure out how many queries you're doing though. It might not be an issue.
__________________
Deranged World |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Oct 2005
Location: Charlotte, NC
Posts: 908
|
If your host offers postgresql, instead of mysql you can use stored procedures for a lot of queries, that might save you on hits to the db.
Not sure what kind of support mysql has for stored procedures these days, if any. And yea, read up on database normalization.
__________________
ICQ: 284903372 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Confirmed User
Join Date: Oct 2006
Posts: 749
|
Quote:
http://dev.mysql.com/doc/refman/5.0/...rocedures.html
__________________
Deranged World |
|
![]() |
![]() ![]() ![]() ![]() ![]() |