For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > June 2006 > Re: Learning php Sql -EDITED- ignore other post from today









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Learning php Sql -EDITED- ignore other post from today
strawberry

2006-06-17, 8:10 am

Well, it's definitely a 'Pass'. I'm not sure I'm qualified to give you
a grade though!

A couple of things. Apologies if they've been covered before...

I think I'd have separate tables for things like Cities and States -
just like you do for ZipCodes, that way they can be selected from drop
down lists - so less chance of typos. In fact, as you go along you
might find ways of constructing context sensitive select boxes, thereby
speeding up data entry (although this might not be such a big deal).

I'd have separate fields for first and last name. You can concatenate
these items when presenting them to the viewer if you like. It just
makes searching by both first name and last name a little neater.

Also, unless you deal with properties on Lake
Chargogagogmanchargogagogcharbunagungamo
g, MA - or insist on referring
to LA by it's (alleged) full proper name - VARCHAR (45) is probably a
little over the top. I suspect VARCHAR(20) would suffice.

Conversely VARCHAR(50) might not be sufficient for websites. This page,
for instance, is listed in my browser as being 185 characters long. I'd
make websites VARCHAR(200) or
VARCHAR(255).

I'm still not sure that the images bit is flexible enough, but I guess
it's a start.

I love that they do pets by weight. Only in America.

Anyway, a great start.

Frankly wrote:
> --
>
> Frank
> PHPmySQL1@yahoo.com
> "Frankly" <PHPmySQL1@yahoo.com> wrote in message
> news:jPVjg.5322$891.5296@trndny01...
>
> That is how I will do it.
> I remember a while back when we talked about the RelationManagementBuildings
> table.
> I wasnt sure if i should put a primary key there and you replied something
> like.
> it is a good idea to have "A" primary key in that table. Some of the stuff
> I
> read says that in some cases it might be better to have both ManagementID
> and BuildingsID set as primaries. However you said "A" primary key. I
> want to build this database according to what you think is best. do you
> think it is better to only use A primary key or should i set both.
>
> in the begining i felt it was better to explore my choices and build tables
> from within the Admin. however at this point you are so right. I just
> created the tables and here goes.
> I am not sure if Management and buildings table should hold the primary keys
> or
> the relations building should hold both.
>
> time to hold my nose and jump in - now the fun starts. i am a bit nervous
> about what I have already forgotten to do
> in the tables below. if you feel something looks like i didnt put enough
> effort into it please tell me the terms I should look up.
>
> Management Table
>
> ManID - Int Auto unless relations table holds both primary keys.
> Name - varchar (45)
> Contact - varchar (45)
> Phone - Varchar (45)
> Address - Varchar (45)
> City - varchar (45) default New York
> State varchar (2) default NY
> ZipCode - Varchar (10)
> Website - Varchar (50)
>
> Buildings Table
>
> BuildingID INT Auto
> Name - Varchar (45)
> Address - varchar ( 50 )
> Cross streetA - Varchar 50
> Cross StreetB - Varchar 50
> WebSite - Varchar 50
> Picture - Varchar 50
> Elevator- varchar 1
> Laundry - varchar 1
> Pets - varchar 1 - sometimes they do allow pets that are smaller than 12lbs.
> so i am thinking pets comments feild.
> pets comments if pets = 1
> Gym -varchar 1
> video intercome varchar 1
> contact varchar 45
> contact phone varchar 45
> Area varchar 45
> Zip Code Varchar 45
>
> RelationManagementBuilding table
>
> ManagementID INT
> BuildingID INT
>
> Apartments Table
>
> ApartmentID - int
> BuildingID - int
> Rent - dec
> AptNumber - varchar 6
> Bedroom - dec 3
> bathroom - dec 3
> WebSite varchar 50
> Picture varchar 50
> Notes - text - there will be 4 picture fields and 1 note field for each
> picture.
> MoveInDate - Date 0000-00-00
> Still Available Varchar 2
>
> ZipArea table
> ZipCode varchar 10
> Area varchar 45
>
> i feel like i am handing in a very important test and this is the easy part.
> how bad did i do.
> i know i have forgotten alot of what i read.
> after this I am going to look into creating relations using the admin tool.
>
> I started this a couple of days ago and have been away since.
> Thank you
> Frank


J.O. Aho

2006-06-17, 8:10 am

strawberry wrote:

> I'm still not sure that the images bit is flexible enough, but I guess
> it's a start.


It depends on what would be stored there, if it's with full path to the image,
then it may or may not be enough, but if it's just the name of the image (you
can hardcode the path, so you don't need to save that in the table), then many
digital cameras uses 8.3 (12 character in total) as the name for the image, in
this case the 50 would be over kill, but then I don't know what Frankly want
to store.


//Aho
Frankly

2006-06-17, 8:10 am



"strawberry" <zac.carey@gmail.com> wrote in message
news:1150305832.027267.316250@y41g2000cwy.googlegroups.com...
> Well, it's definitely a 'Pass'. I'm not sure I'm qualified to give you
> a grade though!



thank you. Aualified or not.. I WILL TAKE IT :).

>
> A couple of things. Apologies if they've been covered before...
>
> I think I'd have separate tables for things like Cities and States -
> just like you do for ZipCodes, that way they can be selected from drop
> down lists - so less chance of typos. In fact, as you go along you
> might find ways of constructing context sensitive select boxes, thereby
> speeding up data entry (although this might not be such a big deal).


I have never really done searches by cites or states. about 99% will be in
New York
and tell you the truth i will never use it.
I cant wait to get up to trying to create contest sensitive select boxes.


>
> I'd have separate fields for first and last name. You can concatenate
> these items when presenting them to the viewer if you like. It just
> makes searching by both first name and last name a little neater.


thank you for bringing that up. I am trying to think if we have ever needed
to do searching
by first or last name. Most of the time I wont have a last name. I
probably have not used a last name in a very long time.
however, I do plan on starting to aim at the smaller landlords and so i
think you are right. I should include those feilds but also also them to be
blank.


>
> Also, unless you deal with properties on Lake
> Chargogagogmanchargogagogcharbunagungamo
g, MA - or insist on referring
> to LA by it's (alleged) full proper name - VARCHAR (45) is probably a
> little over the top. I suspect VARCHAR(20) would suffice.


lol ok.. will do.


>
> Conversely VARCHAR(50) might not be sufficient for websites. This page,
> for instance, is listed in my browser as being 185 characters long. I'd
> make websites VARCHAR(200) or
> VARCHAR(255).


Will do


>
> I'm still not sure that the images bit is flexible enough, but I guess
> it's a start.
>
> I love that they do pets by weight. Only in America.
>
> Anyway, a great start.



Thank you Stawberry. however something happen today that is going to cause
my usual work to take much longer.
but this by far is the most important thing to me as of this moment. I wish
I knew how long it would take to get my site up and running if i stopped all
other work and gave this site 18 hours a day. could it be done in a couple
of days?
I am in uncharted territory. I have no idea what to expect on how hard this
is going to be.

Frank


Frankly

2006-06-17, 8:10 am



"J.O. Aho" <user@example.net> wrote in message
news:4fb1eiF1hup8mU1@individual.net...
> strawberry wrote:
>
>
> It depends on what would be stored there, if it's with full path to the
> image, then it may or may not be enough, but if it's just the name of the
> image (you can hardcode the path, so you don't need to save that in the
> table), then many digital cameras uses 8.3 (12 character in total) as the
> name for the image, in this case the 50 would be over kill, but then I
> don't know what Frankly want to store.
>
>
> //Aho


I will have to go over the other post when my mind is a little more relaxed.
what i would like is to show you a site much like the one I would like to
build.
of course those things you recommend me not getting into will change things
a bit.
www.Anchornyc.com .
i have already purchased a really nice picture to take the place of the 3 on
that page.
tell you the truth. I like that picture so much i would love to just frame
it and put in a few hot spots.
i think 4 pictures per apartment will be good enough, because i have hopes
of having lots of aparments with pictures. i have about 8 hours of realy
hard and really fast data entry. that is just a guess as today will be the
first time I have to do things this way.......... it dont look good. It is
going to effect my advertising greatly. I now need a link to a web site in
my ads more than ever.
tell you the truth i feel like a cartoon character that is running so fast
in one direction and back to the other that all you see is a blur like in a
picture with a realy long exposure time.
do i stop what i am doing to do the site -
do i do what needs to be done in order to survive. <-- tell you the truth i
dont really know what that is or what the best choice is. the slow season
is right around the corner.
oooo It is common to refer to apartments with 1.5 bathrooms when 1 bathroom
does not include a shower and say 2 full bathrooms when both have showers.
I will also use that for apartments that have 1 normal size bedroom and
another that is really a walk in closet. it isnt very often that we find
bedrooms like the ones many of you have. apartments that are no larger than
200 sqft go for $2300 and much higher a month.
some areas you can pay about $1700 a month for the same size place. its all
about location here.
the same apartment only 1 block away from the $2300 can be $500 cheaper a
month and another $500 on the next block. its crazy here.


J.O. Aho

2006-06-17, 8:10 am

Frankly wrote:

> Thank you Stawberry. however something happen today that is going to cause
> my usual work to take much longer.
> but this by far is the most important thing to me as of this moment. I wish
> I knew how long it would take to get my site up and running if i stopped all
> other work and gave this site 18 hours a day. could it be done in a couple
> of days?
> I am in uncharted territory. I have no idea what to expect on how hard this
> is going to be.


A couple of wend I guess you could fix that, much of course depending on
your PHP and SQL skills and how much you already have planed out on paper.

But overworking like 18h/day could of course lead to that it takes a lot
longer than just work 8-10h a day.


//Aho
J.O. Aho

2006-06-17, 8:10 am

Frankly wrote:

> oooo It is common to refer to apartments with 1.5 bathrooms when 1 bathroom
> does not include a shower and say 2 full bathrooms when both have showers.


Here we wouldn't call the "half" for a bathroom but a WC.


> I will also use that for apartments that have 1 normal size bedroom and
> another that is really a walk in closet.


Here we don't call it as a room, so still no need of a half "room" :)


But of course you should on calling things as they are called over there, but
here you never have a half room or bathroom, but if I had been working on
something similar here, I would have more options in that case and only
display those options on the web page that the flat/apartment has.


//Aho
Frankly

2006-06-17, 8:10 am



"J.O. Aho" <user@example.net> wrote in message
news:4fb1eiF1hup8mU1@individual.net...
> strawberry wrote:
>
>
> It depends on what would be stored there, if it's with full path to the
> image, then it may or may not be enough, but if it's just the name of the
> image (you can hardcode the path, so you don't need to save that in the
> table), then many digital cameras uses 8.3 (12 character in total) as the
> name for the image, in this case the 50 would be over kill, but then I
> don't know what Frankly want to store.
>
>
> //Aho


I dont really know what hardcoding the path involves. As to what I want to
do.
I would have to ask your opinions on the subject. which would be better for
me at my skill level lol.
any recommendations on which way to go would be great.

Frank


J.O. Aho

2006-06-17, 8:10 am

Frankly wrote:
> "J.O. Aho" <user@example.net> wrote in message
>
> I dont really know what hardcoding the path involves.


Instead of storing "http://example.net/images/IMAGE.JPG" in the database you
may only store te image name "IMAGE.JPG" in the database, then you can query
the image name from the database and concat it with the hardcoded path.

$fullpathofimage="http://example.net/images/" . $row['ImageName'];


> As to what I want to do.


I think it's a good option.


> I would have to ask your opinions on the subject. which would be better for
> me at my skill level lol.
> any recommendations on which way to go would be great.


I would make an include file where I store variables with values for things I
would have fixed, like the path to the images in this example

---- includefile.php ----
<?PHP
$imagepath="http://example.net/images/";
?>
---- eof ----

and then you include that file to all your scripts and you have only one file
where to change the static info.

---- script1.php ----
<?PHP
include_once('includefile.php');
....
?>
<img src="<?PHP echo $imagepath.$imagename; ?>">
....
---- eof ----


I hope you get the picture of what I mean, bit late here so my brain is a bit
slow at the moment.


//Aho
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com