• Hi everyone,

    I have created a query:
    $sql_query = $wpdb->query(” select category_parent from $wpdb->categories where category_parent>0″);

    And echoed it:
    echo $sql_query;

    Which gives me the # of rows affected by the query.

    NOW..how to work with the results so that I can do something useful ?? ???

    Thanks for helping the noob <blush>.

    Sheri
    P.S. I am looking for the info so that I can customize my navigation. Maybe there is already a function which determines which categories have children (meaning other categories, rather than posts associated to the category)?

Viewing 1 replies (of 1 total)
  • Thread Starter muskokee

    (@muskokee)

    I have worked on the query situation and have come up with a way to get the results I am looking for:

    <?php
    $i_wonder = $wpdb->get_results(“select category_parent from $wpdb->categories where category_parent>0”,ARRAY_N );
    if (in_array(3,$i_wonder[0])){
    echo ‘it is in the array’;
    }else {
    echo ‘sorry’;
    }
    ?>

    So now I know which categories have children…in this case category#3 has a child category.

    This is a great step forward!

    Now I am completely lost when it comes to object oriented programming.<g> I want to use this “test” in the classes.php file, specifically the Walker_Category class, so that I can modify my “” tags with specific classes based on this test.

    Can anyone nudge me in the right direction?

    Thanks
    Sheri

Viewing 1 replies (of 1 total)
  • The topic ‘working with $wpdb->query results’ is closed to new replies.