title: Displaying PHP Data from Query Without Using a Loop
body: <p>I have a query that gets some data that I need to display on my webpage. Here is my query:</p>
  
  <pre><code>$sql1 = "SELECT CAST([Series] AS INT) AS Series
        ,[Master Supplier Title]
        ,[Fund Name]
        ,CAST([Agreement_ID] AS INT) AS Agreement_ID
        ,CAST([Tier_ID] AS INT) AS Tier_ID
        ,[Retro_to_1]
        ,CAST([Payments per Year] AS INT) AS [Payments per Year]
        ,[Condition Unit of Measure]
        ,CAST([Condition Minimum] AS INT) AS [Condition Minimum]
        ,CAST([Condition Maximum] AS INT) AS [Condition Maximum]
        ,CAST([Incentive Multiplier] AS DEC(5,4)) AS [Incentive Multiplier]
    FROM [Test].[dbo].[vExample]
    WHERE [Master Supplier Title] = '$supp' AND [Series] = 1 AND [Fund Name] = '400P' AND [Agreement_ID] = 2
    ORDER BY [Master Supplier Title]";
  </code></pre>
  
  <p>I am then using this chunk of code to display the needed results:</p>
  
  <pre><code>&lt;?php foreach ($pdo-&gt;query($sql1) as $supp11) { ?&gt;
              &lt;label&gt;Agreement ID:&lt;/label&gt;&lt;input value="&lt;?php echo $supp11['Agreement_ID'];?&gt;" readonly&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                  &lt;thead&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                  &lt;/thead&gt;
                  &lt;/tr&gt;
                  &lt;?php foreach ($pdo-&gt;query($sql1) as $supp22) { ?&gt;
                  &lt;tr&gt;
                  &lt;tbody&gt;
                      &lt;td&gt;&lt;?php echo $supp22['Tier_ID'];?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $supp22['Incentive Multiplier'];?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $supp22['Condition Minimum'];?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $supp22['Condition Maximum'];?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $supp22['Condition Unit of Measure'];?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $supp22['Retro_to_1'];?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $supp22['Payments per Year'];?&gt;&lt;/td&gt;
                  &lt;/tbody&gt;
                  &lt;/tr&gt;
                  &lt;?php } ?&gt;
              &lt;/table&gt;
              &lt;?php } ?&gt;
  </code></pre>
  
  <p>The variable <code>$supp</code> that you see is the value that I get from my dropdown selection that I have in some previous code.</p>
  
  <p>Whenever, I make a dropdown selection, it displays the correct data. However, I only need it to display in a table one time. For example, a selection may be in multiple rows of the database. So whenever it is displaying the results in a table, it is displaying the results in a table the number of times that the dropdown selection is seen in the database. So, if the value in my <code>$supp</code> variable is seen 8 times in the database, I only need that info (8 rows) in a table ONE TIME. Not eight different times like I am currently getting.</p>
  
  <p>How can I fix this problem?</p>