Hi again all (I'm sure you'll be sick of all my questions soon!),
I am a nube when it comes to PHP, but I am doing my best to learn. I have read the first few chapters of PHP and MYSQL by Larry Ulman and 'think' I have a basic grasp.
The first page I want to create is the homepage for my vbulletin powered forum/site. The page will contain a mix of static html and a bunch of queries from vbulletin.
The queries on the page will simply be calling in thread data. Latest threads posted from certain sections (eg forum sections used for articles, news, guides etc).
They will be laid out with one main story at the top, followed by two featured stories underneath. Then blocks for the latest 10 threads from each of the articles section, news section, guides section.
I'll be able to flag which story is the main or a feature, by using different thread icons.
I guess there are two ways to do this. Either have a seperate query for each bit. Eg one query for the main story, another for the two featured items, then one each for the latest 10 threads from the articles, news, guides section.
Have one query for the lot and use PHP to sort and display them accordingly.
What do you think is the best way to go about it? I guess the query for each will be the easiest - but how much more difficult will it be to get PHP to sort the data how I want it? Don't forget I am a nube lol (although eager to learn :)) Any other thoughts or considerations?
Thanks in advance for your help.
__________________ PS3 Forums on GameSlurp - the site for gaming fans!
It really depends on how the data is related. Using multiple queries when you can perform a single JOIN statement is inefficient, but it doesn't always work that way. Your PHP script logic should determine what data is presented where, it doesn't have to create a query at each segment.
The bottom line is your skill level and the amount of traffic you expect. Once you progress and have worked with SQL a bit you can refactor all your code to be more efficient. By that time the site may have so much traffic you'll be forced into optimizing everything.