boradsailer Posted April 4, 2011 Share Posted April 4, 2011 Looking at a forum like PHPbb or similar. Wondering if anyone can tell me how the system (or scripts) manages to pull all the user information when viewing a thread without a massive amount of database calls? For example, lets say 1 thread has 10 different users associated to it. When you view the thread, on the left you see the username, their avatar, when the membership was created, maybe even the users level or amount of interaction. So, for each thread view (or page view) does the program do a SQL Select back to the user database for each user's information or is the users information being pulled from cache somewhere? Any insight into the logistics is greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/232679-question-how-do-they-do-it-in-php/ Share on other sites More sharing options...
ignace Posted April 4, 2011 Share Posted April 4, 2011 You join the users table against the posts table, this will give you the member information for each post. SQL query would look something like: SELECT .., posts.viewCount, users.username, users.avatar, users.postCount, .. FROM posts INNER JOIN users USING(user_id) Quote Link to comment https://forums.phpfreaks.com/topic/232679-question-how-do-they-do-it-in-php/#findComment-1196753 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.