Reply
adding # of comments to table
Old 05-03-2006, 08:35 PM adding # of comments to table
one
Experienced Talker

Posts: 44
i'm working on a site that has downloads.i have added a comment mod to the script.
i have a comments table.how can i add # of comments to the files table?
one is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-04-2006, 01:31 AM Re: adding # of comments to table
mtishetsky's Avatar
King Spam Talker

Posts: 1,117
Name: Mike
Location: Mataro, Spain
There are two reasonable approaches.
1. Every time you show a single file or a listing of files "select count(*) from comments where file_id = ... " for single file or "... where file_id in (...)" for a listing of files with further numbers assignment within php.
2. Every time a user adds a comment "update files set comments_count = comments_count + 1 wher file_id = ...", but first you will have to count numver of comments that already exists.
The second way is less resource-consuming, but needs more attention while being implemented not to lose some comments if done unproperly.
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-04-2006, 08:23 AM Re: adding # of comments to table
one
Experienced Talker

Posts: 44
thanks for replying,but i dont understand what you said.
my knowledge of sql is somewhat limited.
one is offline
Reply With Quote
View Public Profile
 
Old 05-04-2006, 08:35 AM Re: adding # of comments to table
mtishetsky's Avatar
King Spam Talker

Posts: 1,117
Name: Mike
Location: Mataro, Spain
Did you do all the coding yourself?
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-04-2006, 11:10 AM Re: adding # of comments to table
one
Experienced Talker

Posts: 44
no i downloaded it,(pafiledb) and i added the comment mod which needed a sql query to add the comment table.
one is offline
Reply With Quote
View Public Profile
 
Old 05-05-2006, 02:12 AM Re: adding # of comments to table
mtishetsky's Avatar
King Spam Talker

Posts: 1,117
Name: Mike
Location: Mataro, Spain
Dammit man, I cannot tell you where to add what exactly. You need some basic knowledge of php and mysql to do what you want, because your problem is rather simple.
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-05-2006, 09:14 PM Re: adding # of comments to table
one
Experienced Talker

Posts: 44
sorry now i know what you were saying.
not thinking clear latly.
1.doesn't sound good.
2.there is no comment count in files,hense the reason for the topic.
the php i might be able to do or find out how.
i know some php,but it is mainly editing or copying from other scripts.
one is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to adding # of comments to table
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14515 seconds with 12 queries