
March 23rd, 2002, 12:09 PM
|
|
|
|
Join Date: Apr 2007
Location: Athens, Hellas
Posts: 8
Time spent in forums: 6 m 53 sec
Reputation Power: 0
|
|
|
Primary & Foreign Keys at MySQL
I'm builing a news sytem based at MySQL and PHP. I also want to include comments for the user. So what I want is when a user clicks to read the story (i.e. index.php?id=1) he will be redirected to a page which will have the story and some comments posted by users.
Being new to all of these (PHP, MySQL) I presume I have to set a primary key for the stories table (i.e. newsid) and a foreign key at the comments table (i.e. commentsid -primary-, newsid -foreign from news table-). Anyone know how to do that with phpMyAdmin?
For the end, how can I make it in the script (index.php) so eveytime someone submits a comment (insert into comments table) will be displayed below the news story?
P.S: Sorry for my grammar...
|