Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-21-2010, 04:10 PM forum psudocode
Extreme Talker

Posts: 176
Trades: 0
when making a forum with php + mysq

when you view a thread, its grabbing a bunch of posts that belong to it, but each post has information about the user who posted it

should for each post it opens the user database and grabs the information? or is there another way to do this? how do forums usually handle this?
Skeddles is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-21-2010, 05:39 PM Re: forum psudocode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
should for each post it opens the user database and grabs the information? or is there another way to do this? how do forums usually handle this?
That depends on the query you have used, it will only return as much, or as little data you have set it to return.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-21-2010, 05:54 PM Re: forum psudocode
Extreme Talker

Posts: 176
Trades: 0
but isn't repetitively querying the database bad? i don't know...
it would only be name posts and signature stuff like that
Skeddles is offline
Reply With Quote
View Public Profile
 
Old 07-21-2010, 06:04 PM Re: forum psudocode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Not necessarily. Certainly, if you can pull all the data back in a single query it can be easier, but making a second call to get limited data can be more efficient than dragging more data back than needed.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-21-2010, 10:58 PM Re: forum psudocode
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
Some forums use cache mechanism to serve frequently visited content.
Go through the source code of PHPBB (It is open-source), you will learn a lot of best practices.
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 07-26-2010, 08:25 PM Re: forum psudocode
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
I'd recommend having user's information and stuff stored in a 'members' table.
Thread information stored in 'threads' table.
Post information (replies) stored in a 'posts' table.

Table structure for posts:

Column:
postID------threadID---postContent---postAuthorUID---postDate

Table structure for threads:

Column:
threadID---replies---original_poster---date---otherstuff

Table structure for members:
Column:
userID---postcount---avatar---username---realname---age---...

Then simple reference things like on the post it will take postAuthorUID and look up that userID in the members table, and display anything it wants about the member.

Very, very vague approach, I know. I can help you more, as I'm making a forum from scratch with PHP & MySQL.

Hope I could help
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to forum psudocode
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.16923 seconds with 12 queries