orderby

6 posts by 3 authors in: Forums > CMS Builder
Last Post: June 6, 2011   (RSS)

By Maurice - June 3, 2011

i wantto create a orderby like first the featured and than all others randomly or the featured randomly and after that the non featured randomly


'orderBy' => "featured RAND(),'RAND()'",

but this dos not seam the work got any ideas??

thnx
-------------------------------------------

Dropmonkey.nl

Re: [Maurice] orderby

By zip222 - June 3, 2011

One way to approach this would be to query your table twice. The first query would be for grabbing the featured article. The second query would be for grabbing the random articles.

Re: [zip222] orderby

By Maurice - June 3, 2011

yes I thought of that but that way i can't let them follow after each other. zo i want all i 1 run to order.
-------------------------------------------

Dropmonkey.nl

Re: [robin] orderby

By Maurice - June 3, 2011

thanx robin but strangly is not working the featured is a check box is that a problem?
-------------------------------------------

Dropmonkey.nl

Re: [Maurice] orderby

By robin - June 6, 2011

If featured is a checkbox, then it will have a value of one or zero in the database. If the featured is going to be first, then here is a small change.

'orderBy' => "featured DESC, RAND()",

Hope that helps!

Robin
Robin
Programmer
interactivetools.com