Jump to content
php.lv forumi

Komentārs savā jaunumā


airbus

Recommended Posts

Tātad man ir jaunums/i zem linka

http://*.lv/?p=news&id=1

un

http://*.lv/?p=news&id=2

 

Gribu uztaisīt komentārus katrā jaunuma savs komentārs.

Piemēram ieieju http://*.lv/?p=news&id=2 un ierakstu komentāru, viss parradas tajā jaunumā, bet es gribu lai viņš neparādas http://*.lv/?p=news&id=1

Link to comment
Share on other sites

Tabula ar foreign key`u uz jaunuma ID.

Aptuveni šitā

CREATE TABLE comments (
id int(10) unsigned not null auto_increment primary_key, 
post_id int(10) unsigned not null,
author varchar(20) not null, 
content text not null,
index(post_id),
foreign key post_id references posts(id))
engine = InnoDB;

komentāru atlase

SELECT id, author, content FROM comments WHERE post_id = :post

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...