locked
How to create a forum with webmatrix RRS feed

  • Question

  • User-1557173817 posted

    Hello please how can i a forum with webmatrix. Database structure, code blocks and general principle. thanks 

    Monday, September 7, 2015 7:40 AM

Answers

  • User-821857111 posted

    You need one table for your users and another for their posts. You could probably do with spending a little time reading up on basic relational database design. Unless you really understand why you need separate tables, you will always struggle. 

    Try this article: http://r937.com/relational.html

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 7, 2015 9:50 AM
  • User753101303 posted

    Hi,

    Sure in short the basic idea is :
    - a table stores a single object type
    - each row has an id which uniquely identifies each object

    You can link a table to another by having a column that tells to which object id it is related (here your blog post will have a column telling the user id of the post author etc.., will have maybe as well the id of the discussion to which it belongs etc....)

    Try perhaps http://www.ntu.edu.sg/home/ehchua/programming/sql/Relational_Database_Design.html for details about db design (as well as others you could find). A forum is not well suited for learning from the beginning but rather to ask questions on a particular problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 7, 2015 11:26 AM

All replies

  • User-821857111 posted

    Decide on your workflows and start writing code to deliver them. When you've begun, come back and post questions about specific issues you encounter.

    Monday, September 7, 2015 8:31 AM
  • User-1557173817 posted

    Basically am having a very big issue with the database structure, especially with linking a user to his post history.

    Monday, September 7, 2015 9:17 AM
  • User-821857111 posted

    Each post should have a foreign key field representing the UserId. If you provide more detail on what the actual issue is (what you want to achieve, what you tried), you might get better help.

    Monday, September 7, 2015 9:24 AM
  • User-1557173817 posted

    here is my database structure. What am trying to achieve is being able to store invidual post by a particular user  to the post column and corresponding dates to the date column.

    id

    Name

    email

    Phone number

    Address

    Country

    Post  

    Date

    1

     

     

     

     

     

     

     

    2

     

     

     

     

     

     

     

    3

     

     

     

     

     

     

     

    4

     

     

     

     

     

     

     

    Monday, September 7, 2015 9:39 AM
  • User-821857111 posted

    You need one table for your users and another for their posts. You could probably do with spending a little time reading up on basic relational database design. Unless you really understand why you need separate tables, you will always struggle. 

    Try this article: http://r937.com/relational.html

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 7, 2015 9:50 AM
  • User-1557173817 posted

    Have gone through the article, now i know i need to create two tables but how will i link both tables together and also linking their individual post. If i want to assign image to user, will i also need to create another table for that.

    Monday, September 7, 2015 10:13 AM
  • User325035487 posted

    If you want to see how link users table with posts table see the example below

    http://sqlfiddle.com/#!3/76356/1

    Monday, September 7, 2015 10:48 AM
  • User-1557173817 posted

    Thank you, does this example apply if am linking four tables together?

    Monday, September 7, 2015 11:10 AM
  • User-1557173817 posted

    and am using webmatrix how do i get the linked userId and postId to the database 

    Monday, September 7, 2015 11:12 AM
  • User753101303 posted

    Hi,

    Sure in short the basic idea is :
    - a table stores a single object type
    - each row has an id which uniquely identifies each object

    You can link a table to another by having a column that tells to which object id it is related (here your blog post will have a column telling the user id of the post author etc.., will have maybe as well the id of the discussion to which it belongs etc....)

    Try perhaps http://www.ntu.edu.sg/home/ehchua/programming/sql/Relational_Database_Design.html for details about db design (as well as others you could find). A forum is not well suited for learning from the beginning but rather to ask questions on a particular problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 7, 2015 11:26 AM
  • User379720387 posted

    Go look for the soccer website tutorial. You can probably find it at www.mikesdotnetting.com

    As part of that tutorial you can learn about the basic db operations.

    Monday, September 7, 2015 4:33 PM
  • User-1557173817 posted

    Ok, have gone through the tutorials, i will appreciate some code blocks to link tables for reference. 

    Tuesday, September 8, 2015 5:02 AM
  • User1313602441 posted
    Guy, your questions are not specific enough.
    And to my understanding, sometimes it is expected that you should already be familiar with some of the basics before asking some questions. That way people know that actual knowledge is being shared.
    And if you're looking for a basic introduction on how to link (or join) tables, then I recommend www.w3schools.com's tutorial on SQL.
    Tuesday, September 8, 2015 6:54 AM
  • User-1557173817 posted

    Have gone through all that, the references have seen so far are just between two tables, my problem is that i have about 9 tables to link. 

    Tuesday, September 8, 2015 7:33 AM
  • User379720387 posted

    This whole process works better if you are considerate of our time.

    With generic questions you get generic answers at best.

    Specific questions are a much better approach.

    What tables do you have so far?

    Tuesday, September 8, 2015 7:41 AM
  • User-821857111 posted

    Have gone through all that, the references have seen so far are just between two tables, my problem is that i have about 9 tables to link. 
    Once you gain an understanding of the principals behind database design, it doesn't matter if you have two tables, nine tables or nine hundred. It seems to me that your problem is in trying to run long before you can walk. I strongly suggest you invest some more time in reading about, and understanding the basics behind what you want to do before moving forward. There are no short cuts to this process. It takes application and time. Failing that, you should consider hiring someone.

    Tuesday, September 8, 2015 8:49 AM