threads help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
harsha
Forum Contributor
Posts: 103
Joined: Thu Jul 11, 2002 1:35 am
Location: Bengaluru (Bangalore) > Karnataka > India

threads help

Post by harsha »

i want to give the option called comments for each article and i want that to store in mysql database i have created two table "artkle" and "comnts "
how do i make the respective comments to display for that specific article using php.

the link is here see this you'll get some idea

http://shadows.sit.ac.in/hungama/index.php
so that you can help me.
User avatar
Phirus
Forum Commoner
Posts: 37
Joined: Thu Apr 18, 2002 4:10 pm
Contact:

Post by Phirus »

What you want to have is relational tables e.g

articles table
========

ID
ART_TITLE
ART_TEXT
ART_AUTHOR

DATA:

1 | ART TITLE | ART TEXT | AUTHOR
2 | ART TITLE | ART TEXT | AUTHOR
3 | ART TITLE | ART TEXT | AUTHOR


comments table
==========

ID
ART_ID
COMMENT_TEXT
COMMENT_AUTHOR

DATA:

1 | 1 | COM TEXT | COM AUTHOR
2 | 2 | COM TEXT | COM AUTHOR
3 | 1 | COM TEXT | COM AUTHOR

In the comments table you have a column that references the article table.

So the above data has:
  • 2 Comments relating to article 1
  • 1 Comment relating to article 2
Good Luck,

Phirus[/list]
Post Reply