<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Grouping</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Grouping-80847</link>
        <description></description>
        <pubDate>Mon, 20 Apr 2026 11:45:15 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Grouping-80847" rel="self" type="application/rss+xml" />

                <item>
          <title>Grouping</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240175#post2240175</link>
          <description><![CDATA[<p>Hi Terry</p>
<p>Glad you found an option that works for you.</p>
<p>Keep us up to date with how you are making out.</p>]]></description>
          <pubDate>Mon, 06 Feb 2017 07:56:22 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240175#post2240175</guid>
        </item>
                <item>
          <title>Grouping</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240170#post2240170</link>
          <description><![CDATA[<p>Hi Ross,</p>
<p>Thanks for your response. I see that while the WHERE clause is no longer part of the code generator it can still be added back as per the older version. Good news!</p>
<p>Looking at it some more, I thought that using the WHERE clause was not the most efficient method because in the event that I added another course then I could need that hardcode that into the template and FTP it to the server, so I used an associative array to group the courses instead and that works much better and is a one-stop shop. For reference, in the event that anyone else is looking for a similar solution, here is what I did:</p>
<p>First create the associative array:</p>
<p><code>          $ValMeals = array(); <br /><br />          foreach ($valentines_dayRecords as $meal) { <br />            $ValCourse = $meal['course']; <br /><br />            if (!array_key_exists($ValCourse, $ValMeals)) { <br />             $ValMeals[$ValCourse] = array(); <br />            } <br /><br />            $ValMeals[$ValCourse][] = $meal; <br />          } <br /></code></p>

<p>Then loop through it:</p>
<p><code>    &lt;?php foreach ($ValMeals as $courses =&gt; $meals): ?&gt;<br />    &lt;h4&gt;&lt;?php echo $courses; ?&gt;&lt;/h4&gt;<br />    &lt;?php foreach ($meals as $meal): ?&gt; <br />      &lt;div class="name-wrap"&gt;<br />          &lt;div class="box"&gt;<br />              &lt;h6 class="box_aside"&gt;&lt;?php echo htmlencode($meal['name_of_dish']) ?&gt;&lt;/h6&gt;<br />              &lt;span class="box_right"&gt;&lt;/span&gt;<br />          &lt;/div&gt;<br />          &lt;p class="brd"&gt;&lt;?php echo htmlencode($meal['description']) ?&gt;&lt;/p&gt;<br />      &lt;/div&gt;<br />        &lt;?php endforeach ?&gt; <br />        &lt;br&gt;&lt;br&gt;<br />      &lt;?php endforeach ?&gt;</code></p>

<p>The output was the following with one set of code rather than having to repeat the code for each course, if I were using the WHERE clause.</p>
<p>    <span style="text-decoration:underline;"><strong>STARTERS</strong></span><br />    Soup of the Day (v)<br />    Smoked Salmon and Prawn Cocktail<br />    Ham Hock Terrine, Apple Relish and Toast<br />    Baked Camembert</p>
<p>    <span style="text-decoration:underline;"><strong>MAIN</strong></span><br />    7oz Ribeye Steak<br />    Baked Chicken Breast<br />    Roast Monkfish<br />    Gnocchi<br /><br />    <span style="text-decoration:underline;"><strong>DESSERT</strong></span><br />    Chocolate Pot and Dipping Fruit<br />    Sticky Toffee Pudding with Vanilla Ice-cream<br />    Passion Fruit Pannacotta<br />    Cheeseboard<br /><br /></p>
<p>Best regards</p>
<p>Terry</p>]]></description>
          <pubDate>Fri, 03 Feb 2017 20:44:17 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240170#post2240170</guid>
        </item>
                <item>
          <title>Grouping</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240169#post2240169</link>
          <description><![CDATA[<p>Hi Terry</p>
<p>Thanks for posting.</p>
<p>Let's take a look at how to setup a "where" statement with your code.</p>
<p>First off, my recommendation is to actually use three different "getRecords" so you can have one list for each course.</p>
<p>Next, let's suppose the code generator gives you the following:</p>
<p><code>// load record from 'meals'<br />  list($mealsRecords) = getRecords(array(<br />    'tableName'   =&gt; 'meals',<br />    'loadUploads' =&gt; true,<br />    'allowSearch' =&gt; false,<br />    'limit'       =&gt; '1',<br />  ));</code></p>
<p>Here's how you'd add a "where" to that:</p>
<p><code>// load record from 'meals'<br />  list($starters) = getRecords(array(<br />    'tableName'   =&gt; 'meals',<br />    'where'       =&gt; "course = 'starters'", // load starters<br />    'loadUploads' =&gt; true,<br />    'allowSearch' =&gt; false,<br />    'limit'       =&gt; '1',<br />  ));</code></p>
<p><strong>Note: </strong>I'm assuming your table name is called "meals" so many sure to update that if it's something else instead.</p>
<p>See the "where" in that?  </p>
<p>To take this to the next step, you can duplicate that block twice more (giving you a total of 3).  </p>
<p>Make sure to adjust the "Where" part so it loads the right course. Also, make sure to change the variable name for "$starters". You can use $mains and $desserts.</p>
<p>Does this all make sense?</p>
<p>Let me know any questions.</p>
<p>Thanks! </p>
]]></description>
          <pubDate>Fri, 03 Feb 2017 09:43:40 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240169#post2240169</guid>
        </item>
                <item>
          <title>Grouping</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240168#post2240168</link>
          <description><![CDATA[<p>Hi,</p>
<p>I can't find a way in the code generator for a WHERE statement ... so, can you tell me how I might group stuff? I am running a food menu categorised as Starters, Mains, Desserts. I want to achieve the following grouping for all three courses which previously I would have used a WHERE statement:</p>
<p><strong>COURSE (e.g. Starts, Mains or Desserts)</strong></p>
<p>Item</p>
<p>Item</p>
<p>Item</p>
<p>The cumbersome way I am doing it, is to hard code the Course name first and then use:</p>
<p><code>&lt;h4&gt;Starters&lt;/h4&gt;<br />&lt;?php if ($record['course']=="Starters"): ?&gt;<br />    &lt;div class="name-wrap"&gt;<br />        &lt;div class="box"&gt;<br />            &lt;h6 class="box_aside"&gt;&lt;?php echo htmlencode($record['name_of_dish']) ?&gt;&lt;/h6&gt;<br />            &lt;span class="box_right"&gt;&lt;/span&gt;<br />        &lt;/div&gt;<br />        &lt;p class="brd"&gt;&lt;?php if($record['description']):?&gt;&lt;?php echo htmlencode($record['description']) ?&gt;&lt;?php endif; ?&gt;&lt;/p&gt;<br />    &lt;/div&gt;<br />&lt;?php endif; ?&gt;<br /></code></p>
<p>Thanks</p>
<p>Terry</p>]]></description>
          <pubDate>Thu, 02 Feb 2017 14:52:12 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240168#post2240168</guid>
        </item>
              </channel>
    </rss>
  