Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

planning a database .. a querie

Status
Not open for further replies.

elebee

Technical User
Jul 8, 2005
23
GB
Hi,

IM building a system where users can input comments into a web page and also be able to look at the past comments they have made. Kind of like a "view history" action.

Im currently planning the databse and have a Comments row for each indiviual user.

How do i store multiple comments in the database for each individual user?

Ive never had to store multiple values in a single row and was wondering how the above is achieved.

Hope someone can help me

Thanks Guys

Ele Bee
 
You create a table for the comments and link the comments back to the user table by way of the user table's unique ID or a strtolower(username) saved into the comments table.
 
ahhh ok,

So the "comments table" would say have three rows.
1. ID
2. Comments
3. Comment date

Then you display the comment/s which refers to the users id number.

So if i used a timestamp for the comment date row, it would be fairly easy to display the latest comment.

Is that the best way of doing things? eg timestamp

Thanks

MattNeeley
 
Makes sense to me. An auto-increment field will also work, but you'd probably want the timestamp of the comment anyway.

There are database forums (MS SQL forum962, MySQL forum436, PostgreSQL forum699) where you'll get a lot of help in designing databases.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top