On 13 Feb 2001, at 11:41, Trond Erling Hundal wrote:
> 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.
>
> 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!
>
> That is: smallnes cannot be shown before 4 "real" newsarticles
has been
> displayed.
>
> What do YOU think?
>
Divide your query in two part. Supposing you're ordering them by
freshness, something like:
"select * from news where Kategory=bignew order by date desc
limit 4"
and
"select * from news where Kategory=smallnew order by date desc
limit 3"
likewise, do 2 cicles, the first showing major news, the second
showing small ones.
This way you don't need a single "if" nor complicated flow control
structure... I've always liked KISS predicate :-)
HTH, bye
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Fabrizio Ermini Alternate E-mail:
C.so Umberto, 7 [EMAIL PROTECTED]
loc. Meleto Valdarno Mail on GSM: (keep it short!)
52020 Cavriglia (AR) [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]