close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help with table relationships and joining tables

Thread began 8/22/2014 2:05 pm by joerg431091 | Last modified 9/04/2014 11:22 am by Jason Byrnes | 2896 views | 15 replies |

joerg431091

Help with table relationships and joining tables

I like to have recipes on the website that the user can display by choosing a certain category.

Lets say the database holds 100 recipes and those are categorized in 5 categories (Meat, Fish, Salad, Soup, Chicken, etc). So the user will click on the category he likes displaying all the recipes within that category.

I can not figure out how to assign one recipe to several different categories so that Recipe 58 for example will be displayed in the meat as well as in the salad category.

So two tables in the DB are recipes and recipescategories

recipes

RecipeID (PK)
RecipeTitle
RecipeDescription
etc…

recipescategories

RecipeCategoryID
RecipeCategoryName

I am new to Databases and struggle if it comes to table relationships and joining tables (obviously). So after researching this it appears that I have to create another table to join those two tables so i did another which is:

recipe_category_join

RecipeID (PK)
RecipeCategoryID (PK)

Am I on the right path to achieve this and is there a tutorial available that shows how something like this is done and also how to do this in the insert and update pages?

Any help that points me in the right direction is greatly appreciated.

Thanks a lot

Joerg

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, you are on the right track.

See the Manage relational tables tutorial for more details.
http://www.webassist.com/tutorials/Manage-relational-tables

Sign in to reply to this post

joerg431091

Great. Thanks a lot Jason.

Best,
Joerg

Sign in to reply to this post

joerg431091

Hi Jason,

One more question in this regards if you don't mind:

I followed the Tutorial and it seems to work absolutely great. Using the Insert and Update pages now allow to assign each recipe to several different categories.

Regarding the Detail page:

I might miss the obvious here but how do I now display the categories a particular recipe or item is assigned to in the detail page? I did bind the recipe categories to the detail page and then used the repeat selection but it shows me all the categories. How do I only show the categories this item is assigned to?

I hope the question makes sense and thanks again for your help.

Best,
Joerg

Sign in to reply to this post

Jason ByrnesWebAssist

See this post for details:
http://www.webassist.com/forums/post/157285/

Sign in to reply to this post

joerg431091

Hi Jason,

Thanks so much for your response.

I followed the instructions in the Blue Sky example and the assigned genres now appear correctly in the items_detail.php page.

The problem I have now is that when I view a record on the detail page and click on “update” from the detail page - only the Genres show up and all other information (item name, short description, long description, etc) is empty. After then clicking Update on the update page - it changes to the detail.php page with the information that the record has been removed.

This only happens if I try to update from the detail page. If I am on the result page and click on update = everything works fine.

Any thoughts?

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

joerg431091

Thanks for your quick response.

I unfortunately have this only on my local machine at the moment. Any "guess" without logging in? If not I have to find a way to upload this somewhere to show you.

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the pages please so i can see the code.

Sign in to reply to this post

joerg431091

Great. Thanks a lot. Pages are attached.

Attached Files
items_detail.php
items_insert.php
items_results.php
items_update.php
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...