Query qizzle quackarooney! :|
| From: | Trond Erling Hundal | Date: | Tue, 13 Feb 2001 10:41:10 +0000 |
| Subject: | Query qizzle quackarooney! :| | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6567@lists.php.net to get a copy of this message | ||
Hey there fellow querieres....
I summon your power! (eh..)
well.. enough with the nonsense :)
I have a littlebit of problem:
I am displaying 15 different newsarticles on a page.
The articles are displayed in three different tables.
First there`s one article (the main-top-story) that is shown in the top of
the page.
Then there is an ad.
And then. Below this ad, there are two columns, each displaying 7 articles
each.
To avoid running multiple queries I do a $i = 0, and a $i++ before I end the
while statement...
($i increments for each time the while loops)
The articles can be divided into two distinct groups.
smallnews, and news, and this is stored in the article table in a field
named Kategory!
Here is the thingy:
I can`t have any smallnews desplaying their ugly faces in the first four
while loops...
That is: smallnes cannot be shown before 4 "real" newsarticles has been
displayed.
How do I go about this without having to write a huge bunch of if/elses (I`m
not sure if that would even work).
==== some notes below to give you an idea of how I am thinking ====
while (.........) {
if (($i < 4) && ($kategory == "smallnews")) {
$i == $i
continue ;
} // Go around another time.....
if (($i == 0) && ($kategory == "newsarticle")) {
echo "<tr><td> etc etc..." ;
} // End writing if it is the first article
Just some scribling here....
if ($kategory == "smallnews")
continue ;
}
}
What do YOU think?
-Trond