|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Forums
hey, first off thanks to kode monkey for helping me with the php highlight...and mostly dlhouston whos been answering 99% of my questions =]...i built a forum script yet im having trouble writing a function on displaying the latest poster and amount of topics for a certain forum...any suggestions on how i can go about doing this...if you want to see my code i can gladly post it =]..thx again...prob will take a long time until someone answers
|
|
#2
|
|||
|
|||
|
I don't know how your forums were made, but I'll assume that you have MySQL as your DB.
If that's the case, you could use a couple of extra queries in your code... select count(id) from posts group by forum This would be to show how many posts are there for each forum select description, user, postDateTime from posts where forum=$criteria order by postDateTime desc limit 1 This would be to show the last post from that specific forum. The way you should use this examples may vary depending how is your current code, but hopefully this could be a start point to determine what you have to do. Hope it helps. MG
__________________
The deal is not to know everything, but to know the email of the one who does. |
|
#3
|
|||
|
|||
|
the thing is i have 3 separate tables for each forums topics and posts....how do i carry the id to display the topic # and etc
|
|
#4
|
|||
|
|||
|
You could use some JOIN, but the easiest way is to use several tables in the same query like this:
select b.description, b.user, a.postDateTime from posts a, threads b where a.forum=$criteria and a.ID=b.postID order by postDateTime desc limit 1 It may have not sense, because I don't know your tables, but hopefully you can deduct how to use more than one table in your query. 1.- Select the fields and tell the query which table is each field from 2.- Use alias for the tables to make it easier 3.- Tell the query what is the field that links the two tables ![]() |
|
#5
|
|||
|
|||
|
gahh thats a mouth full
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Forums |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|