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.

Query Module: results displayed in table; how to hide blank rows...

August 17, 2007 1:29pm

Subscribe [1]
  • #1 / Aug 17, 2007 1:29pm

    stephlivsey

    16 posts

    Hi all,
    I’m pretty green to the SQL module, but I am trying to call up two of my custom weblog fields and have the results displayed in a table using the Query Module tag.
    I actually have that part working:

    http://lynndouglasmedia.com/EE/index.php/TEST_FILES/query_in_table/

    I am wondering if anyone knows how I can prevent the blank/empty rows from showing up.  I am assuming that the empty rows are showing up because the query is pulling data from “exp_weblog_data” and the blank rows are those entries that don’t use my custom fields.  Here’s my short query code:

    {exp:query sql="SELECT field_id_6, field_id_7 FROM exp_weblog_data" ORDER BY field_id_7 ASC}
    <table border=“1” width=“650”>
    <tr>
    <td width=“50”>{field_id_7}</td>
    <td width=“600”>{field_id_6}</td>
    </tr>
    </table>
    {/exp:query}

    Also, the ORDER BY parameter does not work; any ideas?
    Thanks.

    [Mod Edit: Moved to the How-To forum as it is more appropriate]

  • #2 / Aug 17, 2007 1:34pm

    stephlivsey

    16 posts

    Well, never mind…I just tried something and got it figured out; guess I posted too soon. My solution:

    Must add the WHERE weblog_id =’30’ (or whatever group number your weblog id is) and then I moved the ORDER BY parameter to the end of the query and everything worked great!

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

ExpressionEngine News!

#eecms, #events, #releases