2010-09-28, 04:37 PM
For a website I'm working on, I'm tying together the news posts with MyBB threads to make up a comments system.
I've already gotten the commenting bit working, but so I don't need to query the database each time I need to check the number of comments, I want to save the value in the news story database.
I've already implemented this code in my add comment function on the site-end, but I need to do the same if a user posts a comment through the forum. I assume if I use one of the newreply hooks (haven't looked at which one I'll need yet), I'll have access to the tid and can do the SQL queries I need?
One question I have is the $db->query() code --- how would I grab the SQL results from that? Here's a synopsis of the code I'm trying to do:
- Take tid and check to see if any of the news stories have the same value.
- If so, increment the comments count for that news story.
The actual SQL is simple, but I'm not used to how MyBB works.
I've already gotten the commenting bit working, but so I don't need to query the database each time I need to check the number of comments, I want to save the value in the news story database.
I've already implemented this code in my add comment function on the site-end, but I need to do the same if a user posts a comment through the forum. I assume if I use one of the newreply hooks (haven't looked at which one I'll need yet), I'll have access to the tid and can do the SQL queries I need?
One question I have is the $db->query() code --- how would I grab the SQL results from that? Here's a synopsis of the code I'm trying to do:
- Take tid and check to see if any of the news stories have the same value.
- If so, increment the comments count for that news story.
The actual SQL is simple, but I'm not used to how MyBB works.