close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

database?

Thread began 9/11/2013 3:18 pm by jwk | Last modified 9/25/2013 8:55 pm by Jason Byrnes | 2122 views | 35 replies |

jwk

database?

Let say we created two tables the first for projects_tbl and the Second user_tbl ---- Now we want the ability to log the user in and see both the user info and the project info. How do we go about this?

As of now we got a standard login form (dream weaver) that uses the projects_tbl with fields project_number (used for Username) and password..

Not sure if we could just join the two Tables or create a Third table and somehow accomplish this task?

Sign in to reply to this post

Jason ByrnesWebAssist

depends, does each project relate to one user - one to one relationship?

or can a project belong multiple users - many to many relationship.

if the project can only belong to one user, the projects table should have a user ID column, and in that column, store the ID of the user it relates to, then use a standard join query. see the following page for more details:

http://www.w3schools.com/sql/sql_join.asp

Sign in to reply to this post

jwk

project belong multiple users - many to many relationship

Sign in to reply to this post

Jason ByrnesWebAssist

Ok, so in that case you need a 3rd table to link the two and create the many to many relatonship.

projectusers:
projectuserID - primary key
projectuserUserID - relates to the users.userID column
projectuserProjectID - relates to the projects.ProjectID column.

Sign in to reply to this post

jwk

so then for the login page we should use the projectusers_tbl Table?


Then we would have to add a record set to the users table every time we want the user to access a project?

And then on the login success page we would use the projectUsers_tbl Table to accomplish are task of displaying user info and project info?

Sign in to reply to this post

Jason ByrnesWebAssist

no, the login page will use the users table.

when the user logs in, the ID from the users table is stored in a session.

Use that to return the info from the projects table for projects that belong to the user by creating a join query to join the projectusers and projects table.

Sign in to reply to this post

jwk

DB

I think the projectusers_tbl that I did is wrong... I think it should be -- userID and project_id ??

Then I think the users_tbl needs a foreign Key (project_id) ?

Sign in to reply to this post

Jason ByrnesWebAssist

no, you don't need a foreign key in the users table.

the keys are in the userprojects table.

the userprojects table is used to create the user to projects relationships.

this is similar to the items and genres concept from the Mage relational Data tutorial:
http://www.webassist.com/community/tutorials/view_tutorial.php?tid=25

Sign in to reply to this post

jwk

so the projectusers_tbl table is setup correctly?

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, it has the columns that relate to users and projects to create the many to many relationship.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...