View Single Post
Old 02-17-2006, 09:25 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
hi Dew, welcome to the site.

some of this will be guess work since i don't know all the data you want to trac, but i'll use the specs on your page to form a sample of what the table might look like.

- cabin_id - integer, unsigned, auto-increment. this is going to be a field that keeps a unique number for every cabin. when you insert a new cabin, you don't have to set this field because mysql will automatically set it for you. using ids makes it much easier to work with data.

- cabin_name - varchar (64). 64 is just a guess, but basically that is how many characters you can have in this field.

now for "Location" down to "Special Features", you could probably use varchar with the same logic as cabin_name. varchar can go up to 255 characters, so if you need more than that, use text.

special_atmosphere - medium text.

if the format of your rates for each cabin don't change, meaning for each cabin there will always be a daily weekday peak, daily weekday off, holiday weekly peak, holiday weekly off, 7-day .. etc, .. then you can probably use the same table for your rates to keep things simple.

rate_daily_peak - integer(4) unsigned - unsigned just means the number will never be negative. since you're fees are not decimals, you can just use integers. if you charged cents, then you would have to use decimal(4,2)

so basically just go on with the rate_daily_peak for all the rest of your charging fields

rate_daily_off
rate_holiday_peak
rate_holiday_off
rate_7day_peak
rate_7day_off

if the information describing the peak season, off season, and the text under the rates, are the same for every cabin, .. you could probably create another table or just hard code it into the page.

technically you could store images inside the database with a blob, but i would recommend just storing them in a directory on the server. working with images in the database can get slow and difficult to manage.

use a naming scheme like: images/cabins/<cabin_id>/. then you can use PHP to read the directory for the cabin id to create an array of photos.

that place sure looks nice
sde is offline   Reply With Quote