Page 1 of 1

threads help

Posted: Wed Oct 16, 2002 3:43 am
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.

Posted: Wed Oct 16, 2002 6:40 am
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]