ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Double order_by()

October 06, 2014 5:14pm

Subscribe [2]
  • #1 / Oct 06, 2014 5:14pm

    darjusit

    1 posts

    $sql = $this->db->select()->from($lang . ‘_products’)
            ->where($lang . ‘_product_category_id’, $pcid)
            ->where(‘published’, 1)
                                          ->order_by(‘show_in_top’, 1)
              ->order_by(‘created’, ‘DESC’)
            ->get();

    I need firstly order by is ir set to top or and then by creation date. but it messing up some thing. Any suggestions?

  • #2 / Oct 06, 2014 7:40pm

    InsiteFX's avatar

    InsiteFX

    6819 posts

    Because the second parameter is either ASC or DESC not 1.

    Use where show_in_top, 1

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases