<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>filtering record by type</title>
        <link>https://interactivetools.com/forum/forum-posts.php?filtering-record-by-type-81478</link>
        <description></description>
        <pubDate>Mon, 15 Jun 2026 00:56:12 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;filtering-record-by-type-81478" rel="self" type="application/rss+xml" />

                <item>
          <title>filtering record by type</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2242691#post2242691</link>
          <description><![CDATA[<p>Hi petrogus, </p>
<p>How about this? </p>

<pre class="language-php"><code>&lt;?php
  list($articleRecords, $articleMetaData) = getRecords(array(
    'tableName'   =&gt; 'myrecords',  
    'loadUploads' =&gt; true,
    'allowSearch' =&gt; false,
  ));  
  
  list($articleTypesRecords, $articleTypesMetaData) = getRecords(array(
    'tableName'   =&gt; 'rec_type',
    'loadUploads' =&gt; true,
    'allowSearch' =&gt; false,
  ));  

?&gt;

&lt;div class="tabs"&gt;
	&lt;?php foreach($articleTypesRecords as $articleType) { ?&gt;
        &lt;div class="tab-item &lt;?php if ($articleType['num'] == 1) { echo "tab-active"; } ?&gt;"&gt;
          	&lt;a class="tab-label &lt;?php if ($articleType['num'] == 1) { echo "active-btn"; } ?&gt;" data-url="&lt;?php echo $articleType['num']; ?&gt;"&gt;&lt;?php echo htmlencode($articleType['title_'.$_SESSION['lang']]); ?&gt;&lt;/a&gt;
			&lt;div class="tab-content"&gt;
				&lt;?php
          foreach($articleRecords as $articleItem) {
            if ($articleItem['rec_type'] != $articleType['num']) { continue; } // skip articles not in this tab
        ?&gt;
          &lt;article&gt;
            &lt;h3&gt;&lt;a href="sample.php"&gt;&lt;?php echo $articleItem['title']; ?&gt;&lt;/a&gt;&lt;/h3&gt;
            &lt;a href="blog.php?article=&lt;?php echo $articleItem['num']; ?&gt;"&gt;Read more&lt;/a&gt;  
          &lt;/article&gt;
				&lt;?php } ?&gt;
			&lt;/div&gt;  
		&lt;/div&gt;
	&lt;?php } ?&gt;	
&lt;/div&gt;</code></pre>
<p>Your code is looping over $articleTypesRecords to display each tab, then I updated the inner foreach that loops over $articleRecords so it only shows the article if $articleItem['rec_type'] equals the $articleType['num'] for the current tab.</p>
<p>Let me know if that works for you.</p>]]></description>
          <pubDate>Mon, 26 Nov 2018 16:42:23 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2242691#post2242691</guid>
        </item>
                <item>
          <title>filtering record by type</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2242672#post2242672</link>
          <description><![CDATA[<p>Hi Everyone,</p>
<p>I would to filter 'myrecords' base on articleTypesRecords between tabs. I have two types of records and i want to filter at each tab - type.</p>
<p>At the moment 'myrecords' load at both tabs, could you help me please ?!</p>
<pre class="language-markup"><code>&lt;?php
  list($articleRecords, $articleMetaData) = getRecords(array( 'tableName'   =&gt; 'myrecords',  
  'loadUploads' =&gt; true, 'allowSearch' =&gt; false, ));  
  
  list($articleTypesRecords, $articleTypesMetaData) = getRecords(array( 'tableName'   =&gt; 'rec_type', 'loadUploads' =&gt; true, 'allowSearch' =&gt; false, ));  

?&gt;

&lt;div class="tabs"&gt;
	&lt;?php foreach($articleTypesRecords as $articleType) { ?&gt;
        &lt;div class="tab-item &lt;?php if ($articleType['num'] == 1) { echo "tab-active"; } ?&gt;"&gt;
          	&lt;a class="tab-label &lt;?php if ($articleType['num'] == 1) { echo "active-btn"; } ?&gt;" data-url="&lt;?php echo $articleType['num']; ?&gt;"&gt;&lt;?php echo htmlencode($articleType['title_'.$_SESSION['lang']]); ?&gt;&lt;/a&gt;
			&lt;div class="tab-content"&gt;
				&lt;?php foreach($articleRecords as $articleItem) { $articleType = mysql_select("rec_type", "num = '".$articleItem['rec_type']."'"); $articleType = @$articleType[0]; ?&gt;
				&lt;article&gt;
					&lt;h3&gt;&lt;a href="sample.php"&gt;&lt;?php echo $articleItem['title']; ?&gt;&lt;/a&gt;&lt;/h3&gt;
					&lt;a href="blog.php&amp;article=&lt;?php echo $articleItem['num']; ?&gt;"&gt;Read more&lt;/a&gt;  
				&lt;/article&gt;
				&lt;?php } ?&gt;
			&lt;/div&gt;  
		&lt;/div&gt;
	&lt;?php } ?&gt;	
&lt;/div&gt;</code></pre>
]]></description>
          <pubDate>Mon, 19 Nov 2018 12:07:01 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2242672#post2242672</guid>
        </item>
              </channel>
    </rss>
  