dagnasty Posted August 2, 2006 Share Posted August 2, 2006 If I have a comment system for each so and so piece of content on my site, and the comments are in a seperate table. If the comment table is set up like :Comment Table:pagenumber user comment commentnumber34 john Hey, I like to post comments! 305 (auto increment)and to get the comments for the page:select * where pagenumber = '$pagenumber'Would this be the best method for getting the comments if I expect the comments to get into the hundred-thousands?I really can't think of any other way. Link to comment https://forums.phpfreaks.com/topic/16358-mysql-question/ Share on other sites More sharing options...
tensionx Posted August 2, 2006 Share Posted August 2, 2006 How many comments do you want to see per user? Do you want to see the last ten?SELECT top 10,* from (table) WHERE blah blahWhat exactly do you want to see? Link to comment https://forums.phpfreaks.com/topic/16358-mysql-question/#findComment-68019 Share on other sites More sharing options...
dagnasty Posted August 2, 2006 Author Share Posted August 2, 2006 comments are going to be paginated on each page, but I'm asking if that's the method people use? The most efficient way? Link to comment https://forums.phpfreaks.com/topic/16358-mysql-question/#findComment-68021 Share on other sites More sharing options...
bpops Posted August 2, 2006 Share Posted August 2, 2006 That is the method I use on one of my sites, [url=http://www.scriptcrawler.net]http://www.scriptcrawler.net[/url]. If you were looking at all the scripts starting with "a" for example, I select them all, then cycle through them picking out the appropriate ones for each page. I compute the first and last item to pull for each page then display it.My way is a tad complicated though, and I'm not sure if there's a better way. Link to comment https://forums.phpfreaks.com/topic/16358-mysql-question/#findComment-68026 Share on other sites More sharing options...
dagnasty Posted August 2, 2006 Author Share Posted August 2, 2006 Alright cool, thanks a lot.Why don't you set the first letter of the script title as "startswith" in the database at the posting of the script into database, then doselect * where startswith = '$letter' SORT BY title Link to comment https://forums.phpfreaks.com/topic/16358-mysql-question/#findComment-68048 Share on other sites More sharing options...
ryanlwh Posted August 2, 2006 Share Posted August 2, 2006 use LIMIT[code]SELECT * FROM table LIMIT 0,10[/code]Show 10 records, starting from row 0. Link to comment https://forums.phpfreaks.com/topic/16358-mysql-question/#findComment-68055 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.