Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to use multiple tables.</p> <p>The amount of tables depends on how complex you want your interactive site to be. Based on what you have posted you would need a table that would store information about the users, a table for comments, and more such as a table to store status types.</p> <p>For example tbl_Users should store: 1. UserID 2. First Name 3. Last name 4. Email 5. Password (encrypted) 6. Address 7. City 8. State 9. Country 10. Date of Birth 11. UserStatus 12. Etc</p> <p>This project sounds like it should be using a relational DB that will pull up records, such as comments, by relative userIDs.</p> <p>This means that you will need a table that stores the following: 1. CommentID (primary key, int, auto-increment) 2. Comment (text) 3. UserID (foreign key, int)</p> <p>The comment is attached to a user through a foreign key, which is essentially the userId from the tbl_Users table. You would need to combine these tables in an SQL statement with your script to query the information as a single piece of information. See example code</p> <pre><code>$sql_userWall = "SELECT tbl_Users.*, tbl_Comments.*, tbl_userStatus FROM tbl_Users INNER JOIN tbl_Comments ON tbl_Users.userID = tbl_Comments.userID INNER JOIN tbl_UserStatus ON tbl_Users.userID = tbl.UserStatus WHERE tbl_Users.userID = $userID"; </code></pre> <p>This statement essentially says get the information of the provided user from the users table and also get all the comments with that has the same userID attached to it, and get the userStatus from the table of user status'.</p> <p>Therefore you would need a table called tbl_userStatus that held unique statusIDs (primary key, int, auto-incrementing) along with a text (varchar) of a determined length that may say for example "online" or "offline". When you started the write the info out from e record using php, asp or a similar language the table will automatically retrieve the information from tbl_userStatus for you just by using a simple line like</p> <pre><code>&lt;?php echo $_REQUEST['userStatus']; ?&gt; </code></pre> <p>No extra work necessary. Most of your project time will be spent developing the DB structure and writing SQL statements that correctly retrieve the info you want for each page.</p> <p>There are many great YouTube video series that describe relational DBS and drawing entity relational diagrams. This is what you should look into for learning more on creating the tye of project you were describing.</p> <p>One last note, if you wanted comments to be visible for all members of a group this would describe what is known as a many-to-many relationship which would require additional tables to allow for multiple users to 'own' a relationship to a single table. You could store a single groupID that referred to a table of groups.</p> <p>tbl_groups 1. GroupID 2. GroupName 3. More group info, etc</p> <p>And a table of users registered for the group Tbl_groupMembers 1. membershipCountID (primary key, int, auto-increment) 2. GroupID (foriegn key, int) 3. UserID (foriegn key, int)</p> <p>This allows users to registrar for a group and inner join them to group based comments. These relationships take a little more time to understand, the videos will help greatly.</p> <p>I hope this helps, I'll come back and post some YouTube links later that I found helpful learning this stuff.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload