We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Really quick PHP/SQL question

Development and Programming

NKT com's avatar
NKT com
124 posts
16 years ago
NKT com's avatar NKT com

I want to sort the following output by the column “cat_order”. I’m a PHP/SQL newb, i’m sure this will take one of you five seconds. Thanks.

function Vz_subcategories($str = '')
    {
        global $TMPL, $DB;

        $group_id = $TMPL->fetch_param('id');

        $results = $DB->query("SELECT cat_id FROM exp_categories WHERE group_id = '".$group_id."'");

        if ($results->num_rows > 0)
        {
            foreach ($results->result as $row)
            {
                $cats[] = $row['cat_id'];
            }
        }

         $this->return_data = implode('|', $cats);
    }

Btw, This is my mod of this plugin to make it accept a category group instead of parent category.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.