<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Show States if a record exists </title>
        <link>https://interactivetools.com/forum/forum-posts.php?Show-States-if-a-record-exists-79906</link>
        <description></description>
        <pubDate>Mon, 15 Jun 2026 20:05:33 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Show-States-if-a-record-exists-79906" rel="self" type="application/rss+xml" />

                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2236080#post2236080</link>
          <description><![CDATA[<p>Sure, here's how the line should look:</p>
<p><code>&lt;?php if($dealer['num'] != 1 { continue; } ?&gt; //  I will assign which record number I want to filter</code></p>
]]></description>
          <pubDate>Mon, 16 Feb 2015 08:40:27 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2236080#post2236080</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2236069#post2236069</link>
          <description><![CDATA[<p>Oops sorry I do need your help to write the expression correctly.</p>
<p>I know I'm close but. ..</p>

<p>Thanks</p>
<p>Michael</p>]]></description>
          <pubDate>Fri, 13 Feb 2015 10:39:12 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2236069#post2236069</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2236066#post2236066</link>
          <description><![CDATA[<p>Yeah, that'd definitely work. Looks like you don't need my help in fact :P</p>]]></description>
          <pubDate>Fri, 13 Feb 2015 09:25:31 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2236066#post2236066</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2236055#post2236055</link>
          <description><![CDATA[<p>Ok Claire,</p>
<p>The client has added another filter to the mix. They have asked that there be just a list of "agricultural" or "recreational" dealers.</p>
<p>I created a new separate list "dealer_types"(multiple check boxes) and associated it in the dealers section using the field name "type".</p>
<p>What I BELIEVE I need is a "if" {  continue;  } statement to filter only 1 type of dealer by the record number. Or an "if" "else" statement maybe..</p>
<p><code>                            &lt;?php foreach ($canadian_statesRecords as $key=&gt;$record): ?&gt;<br />                                       &lt;? // load records from 'dealers'<br />                                         list($dealersRecords, $dealersMetaData) = getRecords(array(<br />                                         'tableName'   =&gt; 'dealers',<br />                                         'loadUploads' =&gt; false,<br />                                         'allowSearch' =&gt; false,<br />                                         'where' =&gt; "providences LIKE '%\t". mysql_escape($record['num']) . "\t%'", <br />                                          ));<br />                                        ?&gt;<br />                            &lt;?php if(empty($dealersRecords)) { continue; } ?&gt;<br />                                &lt;section class="toggle&lt;?php if ($key == 0) { echo " active"; } ?&gt;"&gt;<br />                                    &lt;label&gt;&lt;?php echo htmlencode($record['title']) ?&gt;&lt;/label&gt;<br />                                    &lt;div class="toggle-content"&gt;<br />                                    &lt;?php foreach ($dealersRecords as $dealer): ?&gt;<br />                                    <span style="color:#ff0000;"><strong>&lt;?php IF DEALER "TYPE" NUM = ANYTHING BUT "1" { continue; } ?&gt;</strong></span> <span style="color:#ff0000;">//  I will assign which record number I want to filter</span> <br />                                    &lt;div class="panel-body"&gt;<br />                                      &lt;strong&gt;&lt;?php echo htmlencode($dealer['title']) ?&gt;&lt;/strong&gt;&lt;br/&gt;<br />                                             &lt;p&gt;<br />                                              &lt;?php echo htmlencode($dealer['address']) ?&gt;&lt;br/&gt;<br />                                              &lt;?php echo htmlencode($dealer['phone']) ?&gt;&lt;br/&gt;<br />                                              Contact: &lt;?php echo htmlencode($dealer['contact_name']) ?&gt;<br />                                             &lt;/p&gt;<br />                                         &lt;hr&gt;<br />                                     &lt;/div&gt;<br />                                     &lt;?php endforeach ?&gt;<br />                                    &lt;/div&gt;<br />                                &lt;/section&gt;<br />                            &lt;?php endforeach ?&gt;</code></p>
<p>Let me know what you think,</p>
<p>Thanks<br />Michael</p>]]></description>
          <pubDate>Thu, 12 Feb 2015 19:45:55 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2236055#post2236055</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235992#post2235992</link>
          <description><![CDATA[<p>Thanks Claire</p>
<p>Works awesome!</p>]]></description>
          <pubDate>Sat, 07 Feb 2015 16:15:30 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235992#post2235992</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235991#post2235991</link>
          <description><![CDATA[<p>Hi Michael, sorry for the delay on this.</p>
<p>If the states are stored as a multiple choice, then it shows up in the database a little differently and thus the where clause needs to be changed. So try this instead:</p>
<p><code>&lt;?php foreach ($statesRecords as $key=&gt;$record): ?&gt;<br />           &lt;? // load records from 'distributors'<br />           list($distributorsRecords, $distributorsMetaData) = getRecords(array(<br />             'tableName'   =&gt; 'distributors',<br />             'loadUploads' =&gt; false,<br />             'allowSearch' =&gt; false,<br />             <strong>'where' =&gt; "states LIKE '%\t". mysql_escape($record['num']) . "\t%'",</strong><br />              ));<br />            ?&gt;<br />   &lt;?php if(empty($distributorsRecords)) { continue; } ?&gt;<br />   &lt;div class="panel-group secundary" id="accordion2"&gt;<br />     &lt;div class="panel panel-default"&gt;<br />       &lt;div class="panel-heading"&gt;<br />        &lt;h4 class="panel-title"&gt;<br />         &lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse2&lt;?php echo $key;?&gt;"&gt;&lt;?php echo htmlencode($record['title']) ?&gt;&lt;/a&gt;<br />        &lt;/h4&gt;<br />       &lt;/div&gt;<br />       &lt;div id="collapse2&lt;?php echo $key;?&gt;" class="accordion-body collapse"&gt;<br />           &lt;?php foreach ($distributorsRecords as $distributor): ?&gt;<br />             &lt;div class="panel-body"&gt;<br />               &lt;strong&gt;&lt;?php echo htmlencode($distributor['title']) ?&gt;&lt;/strong&gt;&lt;br/&gt;<br />               &lt;p&gt;&lt;?php echo htmlencode($distributor['address']) ?&gt;&lt;br/&gt;<br />                  &lt;?php echo htmlencode($distributor['phone']) ?&gt;&lt;br/&gt;<br />                  Contact: &lt;?php echo htmlencode($distributor['contact_name']) ?&gt;<br />               &lt;/p&gt;<br />                                          &lt;hr&gt;<br />              &lt;/div&gt;<br />           &lt;?php endforeach ?&gt;<br />                                    <br />         &lt;/div&gt;<br />     &lt;/div&gt;<br />   &lt;/div&gt;<br /> &lt;?php endforeach ?&gt;</code></p>
<p>This might need some tweaking to get it right though.</p>]]></description>
          <pubDate>Fri, 06 Feb 2015 15:25:15 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235991#post2235991</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235990#post2235990</link>
          <description><![CDATA[<p>Do you need anything else from me?</p>]]></description>
          <pubDate>Fri, 06 Feb 2015 15:06:31 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235990#post2235990</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235985#post2235985</link>
          <description><![CDATA[<p>In this case I used a pull down multiple choice list. But I usually use check boxes.  Are there separate ways to express both?</p>]]></description>
          <pubDate>Wed, 04 Feb 2015 16:17:07 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235985#post2235985</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235983#post2235983</link>
          <description><![CDATA[<p>Okay, what kind of list is it? A dropdown? A multiselect? Checkboxes?</p>]]></description>
          <pubDate>Wed, 04 Feb 2015 14:39:30 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235983#post2235983</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235982#post2235982</link>
          <description><![CDATA[<p>Okay, what kind of list is it? A dropdown? A multiselect? Checkboxes?</p>]]></description>
          <pubDate>Wed, 04 Feb 2015 14:39:28 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235982#post2235982</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235978#post2235978</link>
          <description><![CDATA[<p>It is one of two lists that is used inside the distributors list (see attached)</p>
<p>So there is the loop of States with a loop of distributors inside of it and then there will also be a loop of Providences with a loop of distributors right afterward. So you are only seeing the code for the first loop.</p>
<p>I was hoping to replicate the solution for the Providences once I had that. Just needed to get it working properly. </p>

<p>Hope that helps <br />Thanks</p>]]></description>
          <pubDate>Wed, 04 Feb 2015 10:44:21 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235978#post2235978</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235975#post2235975</link>
          <description><![CDATA[<p>Hi Michael</p>
<p>What's the 'states' field in the distributor table look like? Is it a list?</p>]]></description>
          <pubDate>Wed, 04 Feb 2015 09:44:22 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235975#post2235975</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235969#post2235969</link>
          <description><![CDATA[<p>OK I think my 'where' statement must be wrong. If I comment the 'where' statement out, I get the list of ALL possible distributors in each state. When I set the line back then I get NO states showing at all. So it must no be sorting the records correctly.</p>
<p>Any ideas?</p>]]></description>
          <pubDate>Tue, 03 Feb 2015 20:51:41 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235969#post2235969</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235964#post2235964</link>
          <description><![CDATA[<p>Hi Michael</p>
<p>There's a few different ways to do this depending on how efficient you want to be, but here's the simplest way:</p>
<p><code>&lt;?php foreach ($statesRecords as $key=&gt;$record): ?&gt;<br />          &lt;? // load records from 'distributors'<br />          list($distributorsRecords, $distributorsMetaData) = getRecords(array(<br />            'tableName'   =&gt; 'distributors',<br />            'loadUploads' =&gt; false,<br />            'allowSearch' =&gt; false,<br />            'where' =&gt; "states = '". $record['num'] . "'",<br />             ));<br />           ?&gt;<br />  <strong>&lt;?php if(empty($distributorsRecords)) { continue; } ?&gt;</strong><br />   &lt;div class="panel-group secundary" id="accordion2"&gt;<br />     &lt;div class="panel panel-default"&gt;<br />       &lt;div class="panel-heading"&gt;<br />        &lt;h4 class="panel-title"&gt;<br />         &lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse2&lt;?php echo $key;?&gt;"&gt;&lt;?php echo htmlencode($record['title']) ?&gt;&lt;/a&gt;<br />        &lt;/h4&gt;<br />       &lt;/div&gt;<br />       &lt;div id="collapse2&lt;?php echo $key;?&gt;" class="accordion-body collapse"&gt;<br />           &lt;?php foreach ($distributorsRecords as $distributor): ?&gt;<br />             &lt;div class="panel-body"&gt;<br />               &lt;strong&gt;&lt;?php echo htmlencode($distributor['title']) ?&gt;&lt;/strong&gt;&lt;br/&gt;<br />               &lt;p&gt;&lt;?php echo htmlencode($distributor['address']) ?&gt;&lt;br/&gt;<br />                  &lt;?php echo htmlencode($distributor['phone']) ?&gt;&lt;br/&gt;<br />                  Contact: &lt;?php echo htmlencode($distributor['contact_name']) ?&gt;<br />               &lt;/p&gt;<br />                                          &lt;hr&gt;<br />              &lt;/div&gt;<br />           &lt;?php endforeach ?&gt;<br />                                    <br />         &lt;/div&gt;<br />     &lt;/div&gt;<br />   &lt;/div&gt;<br /> &lt;?php endforeach ?&gt;</code></p>
<p>This checks the list of distributors and skips the state if no distributors are found.</p>]]></description>
          <pubDate>Tue, 03 Feb 2015 09:29:51 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235964#post2235964</guid>
        </item>
                <item>
          <title>Show States if a record exists </title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2235960#post2235960</link>
          <description><![CDATA[<p>I have a list of distributors populating from a list of states.</p>
<p><code>  list($statesRecords, $statesMetaData) = getRecords(array(<br />    'tableName'   =&gt; 'states',<br />    'loadUploads' =&gt; false,<br />    'allowSearch' =&gt; false,<br />  ));<br /><br /><br />-------------------------------------------------------------<br /><br /><br /><br /><br />&lt;?php foreach ($statesRecords as $key=&gt;$record): ?&gt;<br />  &lt;div class="panel-group secundary" id="accordion2"&gt;<br />    &lt;div class="panel panel-default"&gt;<br />      &lt;div class="panel-heading"&gt;<br />       &lt;h4 class="panel-title"&gt;<br />        &lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse2&lt;?php echo $key;?&gt;"&gt;&lt;?php echo htmlencode($record['title']) ?&gt;&lt;/a&gt;<br />       &lt;/h4&gt;<br />      &lt;/div&gt;<br />      &lt;div id="collapse2&lt;?php echo $key;?&gt;" class="accordion-body collapse"&gt;<br />          &lt;? // load records from 'distributors'<br />          list($distributorsRecords, $distributorsMetaData) = getRecords(array(<br />            'tableName'   =&gt; 'distributors',<br />            'loadUploads' =&gt; false,<br />            'allowSearch' =&gt; false,<br />            'where' =&gt; "states = '". $record['num'] . "'",<br />             ));<br />           ?&gt;<br />          &lt;?php foreach ($distributorsRecords as $distributor): ?&gt;<br />            &lt;div class="panel-body"&gt;<br />              &lt;strong&gt;&lt;?php echo htmlencode($distributor['title']) ?&gt;&lt;/strong&gt;&lt;br/&gt;<br />              &lt;p&gt;&lt;?php echo htmlencode($distributor['address']) ?&gt;&lt;br/&gt;<br />                 &lt;?php echo htmlencode($distributor['phone']) ?&gt;&lt;br/&gt;<br />                 Contact: &lt;?php echo htmlencode($distributor['contact_name']) ?&gt;<br />              &lt;/p&gt;<br />                                         &lt;hr&gt;<br />             &lt;/div&gt;<br />          &lt;?php endforeach ?&gt;<br />                                   <br />        &lt;/div&gt;<br />    &lt;/div&gt;<br />  &lt;/div&gt;<br /> &lt;?php endforeach ?&gt;</code></p>
<p>Can I write it somehow to list ONLY the states that actually have a distributor. Please Note: I built this as a list of states that are associated in a list of distributors. Maybe I need to move that get records to the outside of the loop?</p>
<p>Let me know what you think.</p>]]></description>
          <pubDate>Mon, 02 Feb 2015 18:59:08 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2235960#post2235960</guid>
        </item>
              </channel>
    </rss>
  