Need advise on a little project.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Need advise on a little project.

Postby Rippie » Sun Jan 10, 2010 12:47 pm

Hi everyone,

This is my very first post, so i just want to say hi to everyone, and thanks to anyone who help me with this.

So back to the point, my manager would like me and a colleague to start on a little project, and i could really do with some advise on how to do this. Project is:

A page that shows what 12-15 technical people are doing 2 weeks ahead, so that sales people can see when there is presale/webex resource available. At first my colleage and i was thinking just to make a few databases for technical people, for vendors, Products and then a database with 14 days in it. DAY1,DAY2,DAY3 etc. Then we realised how difficult that is going to be, for not to mention the constant update.
I have since thought of something else, getting a "calendar" php script and then expand this to integrate with technical people and with vendors and products. Do not worry about the admin behind the scenes just yet, but in future i will get make a nice back-end for admin.

If there is an already script out there, dont hesitate to post it.

Example on how my manager wants it:

Vendor - Product - Day1, Day2, Day3, Day4, Day5, Day6, Day7, Day8, Day9, Day10
McAfee - Sidewinder - Available, Not, Available, etc, ect

Thanks in advance.
Rippie
Rippie
Forum Commoner
 
Posts: 76
Joined: Sun Jan 10, 2010 12:32 pm
Location: Nottingham

Re: Need advise on a little project.

Postby social_experiment » Sun Jan 10, 2010 5:37 pm

Then we realised how difficult that is going to be, for not to mention the constant update.


1.If it's going to be a static schedule that doesn't change for any given amount of time, you could just do a static HTML coded page. For something more dynamic you will have to use either a flat file or database.

2. I don't think you need a database for days, just add a column inside the 'personel' table called 'day' ( or something similar | more applicable ) and add the day number on which that specific person will be doing something ( if bob will be doing floors on the 2nd day, add a '2' in that column. ), then select the records according to days and you should get all the records of people doing something on day 1 together, people doing something on day 2 together, etc. From a quick guesstimation you could probably do it using just one table in a database.
To forget one's purpose is the commonest form of stupidity.
User avatar
social_experiment
Forum Contributor
 
Posts: 326
Joined: Sun Feb 15, 2009 12:08 pm

Re: Need advise on a little project.

Postby tasairis » Sun Jan 10, 2010 6:47 pm

Two tables:
First lists vendors and their products*.
Second has days available**. It tracks a product/vendor and a date***.
To query, you look up the products with an OUTER JOIN on the dates available in whatever date range you want.

* You could have a second table: one for vendors and one for products, but if all you have for a vendor is their name then (IMO) it's not worth the extra effort to split them off into a separate table... unless you think additional information might be added later (eg, vendor website, contact info, etc)

** Or unavailable. Whichever has the fewest records (if stuff is more often available than unavailable, store the unavailable dates).

*** A better design would be to track both available and unavailable. If you think you can go this far, do it.
Use [syntax=php] tags to highlight your PHP code | If I don't give the solution it's because I think you can figure it out | Edits in purple
User avatar
tasairis
DevNet Master
 
Posts: 3417
Joined: Wed Oct 15, 2008 2:35 am
Location: WA

Re: Need advise on a little project.

Postby Rippie » Mon Jan 11, 2010 9:06 am

tasairis wrote:Two tables:
First lists vendors and their products*.
Second has days available**. It tracks a product/vendor and a date***.
To query, you look up the products with an OUTER JOIN on the dates available in whatever date range you want.

* You could have a second table: one for vendors and one for products, but if all you have for a vendor is their name then (IMO) it's not worth the extra effort to split them off into a separate table... unless you think additional information might be added later (eg, vendor website, contact info, etc)

** Or unavailable. Whichever has the fewest records (if stuff is more often available than unavailable, store the unavailable dates).

*** A better design would be to track both available and unavailable. If you think you can go this far, do it.


To have 1 table with vendors and their products was what i thought of first, but then i thought about how to make that table, because some vendors only have 3 products and others 20. i was thinking doing like this: ID - VENDOR - PROD1 - PROD2 - PROD3 - PROD4 and for vendors with only 3 products, just put a 0 in PROD4 and up to PROD20 just so i know it is blank.

the scope of days here is for the whole year, but only to show 14 days at a time, that is the reason for why i was thinking to have a calender or something built into it. so it knows that day and date.

Not sure how i should do this. would be nice to make an admin page where i can click on a name on a specific date and put im in or out the office. and then the DB's would update. without me having to put in the days manually.
Rippie
Forum Commoner
 
Posts: 76
Joined: Sun Jan 10, 2010 12:32 pm
Location: Nottingham

Re: Need advise on a little project.

Postby timWebUK » Mon Jan 11, 2010 9:14 am

That's not how you would do it surely? You would have a table containing vendor information, then a table containing product information. Then they'd would be connected via a relation.

1 to many relation between vendor and product.
User avatar
timWebUK
Forum Contributor
 
Posts: 218
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: Need advise on a little project.

Postby Rippie » Mon Jan 11, 2010 9:34 am

timWebUK wrote:That's not how you would do it surely? You would have a table containing vendor information, then a table containing product information. Then they'd would be connected via a relation.

1 to many relation between vendor and product.


Hi Tim, thx for your post, would you care to explain to me a bit more ?

The way you describe it, to have a table containing vendor and one for product information. did you have something like this in mind:

VENDOR:
VENDOR_ID - Vendor
1 - McAfee

PRODUCT:
PROD_ID - VENDOR_ID - PROD_NAME
1 - 1 - Web Gate Way

I also imagine that i would need a table for technical people ? NAME_ID - NAME ? then another table that link technical people to a product ? ID - NAME_ID - PROD_ID ?
Rippie
Forum Commoner
 
Posts: 76
Joined: Sun Jan 10, 2010 12:32 pm
Location: Nottingham

Re: Need advise on a little project.

Postby timWebUK » Mon Jan 11, 2010 10:46 am

Not sure whether or not vender's have technicians, so leaving that out. Assuming a technician can provide advice on multiple products...

tblVender

-intVenderID (Primary Key)
-strVenderName

tblProduct

-intProdID (Primary Key)
-strProdName
-intVenderID (Foreign Key)

tblTechnician

-intTechID (Primary Key)
-strTechName
-intProdID (Foreign Key)


tblTechnician 1-* tblProduct
(One-to-many, one technician provides advice on many products)

tblVender 1-* tblProduct
(One-to-many, one vender provides many products)


By no means a perfect implementation, other people here might have something to say about that...
User avatar
timWebUK
Forum Contributor
 
Posts: 218
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: Need advise on a little project.

Postby Rippie » Tue Jan 12, 2010 5:59 am

timWebUK wrote:tblTechnician 1-* tblProduct
(One-to-many, one technician provides advice on many products)

tblVender 1-* tblProduct
(One-to-many, one vender provides many products)


Sorry Tim, dont understand this bit, would you mind explain it ?
Rippie
Forum Commoner
 
Posts: 76
Joined: Sun Jan 10, 2010 12:32 pm
Location: Nottingham

Re: Need advise on a little project.

Postby papa » Tue Jan 12, 2010 7:11 am

You can also take a look at Sharepoint, there is a free version available. There a tons of scripts out there that could probably help you. It's not PHP though, but saves a lot of time depends on your requirements of course.
User avatar
papa
Forum Regular
 
Posts: 954
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Need advise on a little project.

Postby timWebUK » Tue Jan 12, 2010 7:55 am

Rippie wrote:
timWebUK wrote:tblTechnician 1-* tblProduct
(One-to-many, one technician provides advice on many products)

tblVender 1-* tblProduct
(One-to-many, one vender provides many products)


Sorry Tim, dont understand this bit, would you mind explain it ?


When you have a relationship in a database between tables they joined by a primary key and foreign key. They also have a link that can be, 1-1, *-1, 1-*, or *-* (many to many, but this is frowned upon).

As each vender can have multiple products, you explain it by saying each vender (one vender), has many products.
User avatar
timWebUK
Forum Contributor
 
Posts: 218
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: Need advise on a little project.

Postby pytrin » Tue Jan 12, 2010 8:02 am

Why is many-to-many frowned upon? :?
A very common and useful relationship.
User avatar
pytrin
DevNet Master
 
Posts: 3207
Joined: Fri Jan 18, 2008 1:36 am
Location: Israel, ME

Re: Need advise on a little project.

Postby timWebUK » Tue Jan 12, 2010 8:53 am

If there is a many-many relationship you're missing an entity, it doesn't make sense.

It would be better to have many - one<new entity>one - many.

This article can explain it better than me:

http://www.tomjewett.com/dbdesign/dbdes ... nymany.php
User avatar
timWebUK
Forum Contributor
 
Posts: 218
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: Need advise on a little project.

Postby pytrin » Tue Jan 12, 2010 10:49 am

I'm not sure what you're referring to. A many-to-many relationship is implemented using a pivot table (or a junction table as the article refers to it). What part of this is frowned upon or doesn't make sense?
User avatar
pytrin
DevNet Master
 
Posts: 3207
Joined: Fri Jan 18, 2008 1:36 am
Location: Israel, ME

Re: Need advise on a little project.

Postby aravona » Tue Jan 12, 2010 10:59 am

pytrin wrote:I'm not sure what you're referring to. A many-to-many relationship is implemented using a pivot table (or a junction table as the article refers to it). What part of this is frowned upon or doesn't make sense?


I never really got why but I just did as I was told. Many to Many relationships is taught at university as wrong, having one in an assignment project would cause you to be marked down, as your database would not be fully normalised. So you'd get rid of duplicates and columns not dependant on your primary key etc etc (i hate normalisation, and promptly forgot it after my exams)

normalisation
FD in Computing, CCNA1
like reading? visit L.U.N.E We're a growing site about literature..
aravona
Forum Contributor
 
Posts: 315
Joined: Sat Jun 13, 2009 3:59 pm
Location: England

Re: Need advise on a little project.

Postby timWebUK » Tue Jan 12, 2010 12:26 pm

pytrin wrote:I'm not sure what you're referring to. A many-to-many relationship is implemented using a pivot table (or a junction table as the article refers to it). What part of this is frowned upon or doesn't make sense?


The pivot/junction table is the additional entity which makes the tables theoretically not many-many.
User avatar
timWebUK
Forum Contributor
 
Posts: 218
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Next

Return to PHP - Code

Who is online

Users browsing this forum: crammy15b, Google [Bot] and 1 guest

cron