I'm been slowly learning a bit of PHP and the first real world script that I want to write is simply to display the first few active topics in a Phpbb forum database on my index page.
Now I'm very much the beginner and only know a little php but I'm not going to cheat and ask people to write my code for me, but some pointers would help.
I've looked at the MySQL select command and can see how it works and I shouldn't have a problem getting data out of the database. The problem I have is that I want to display x number of the most recent topics (based on the most recent posts). I can't simply pick the right number of posts and reference the relavent topics from these as several of the posts are likely to occur in the same topic and I don't want the same topic appearing twice in the list. What I need to do is take the first post then move on the the next post, discounting it if its topic number matches the topic number of a post already picked. I think I can see how to do this with logical php code once the posts have been selected but it would seem less effort to simply pick the correct posts using the select command and print them out.
I see that I can use the where clause to place conditions for the select command but I'm unsure what conditions to use. I need to select a post whose topic value is unique from the post value of records have been already placed in the selection by the select command (not unique to the database from which the select command is picking out the records). Can I use the where clause to compare fields in records against records already selected or should I crawl through the database selecting records using php logic?
Sorry if things don't make sense but I know what I mean.