title: PHP echo '<p>' printing <p> </p>
body: <p>I am trying to create a loop in php to display a list of categories the loop is working fine and sql queries pulls all the correct information however I'm trying to echo out a <code>&lt;p&gt;</code> tag for every 4 times the loop increments, this creates a new line on my site design. How ever the issue being when I echo a p tag using <code>echo '&lt;p&gt;';</code> it creates a closing tag straight after.</p>
  <p>Here is my code:</p>
  <pre><code>        echo '&lt;!-- Create first 4 --&gt;&lt;P&gt;';
                      while($row1 = mysql_fetch_array($result1))
                          {  
                          
                          echo '&lt;div class=&quot;cat&quot;&gt;';     
                          echo '&lt;img src=&quot;'.$row1['IMAGE'].'&quot; alt=&quot;'.$row1['NAME'].'&quot;&gt;';
                          echo '&lt;h2&gt;'.$row1['NAME'].'&lt;/h2&gt;';
                          echo '&lt;/div&gt;';
                          $i++;
                          
                          //force a new line of catagories
                          if (( $i == 4 )||( $i == 8 )||( $i == 12 ))
                              {
                                  echo '&lt;!-- if more than 4 Close first 4 --&gt;&lt;/p&gt;';
                                  echo '&lt;!-- Create second 4 --&gt;&lt;p&gt;'; 
                              }       
                          } 
                          echo '&lt;!-- close first 4 --&gt;&lt;/p&gt;';
  </code></pre>
  <p>When this is run in firefox and i check the source code i get this:</p>
  <pre><code>    &lt;div class=&quot;content&quot;&gt;
        &lt;!-- Create first 4 --&gt;
      &lt;p&gt;&lt;/p&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;
        &lt;!-- if more than 4 Close first 4 --&gt;
      &lt;p&gt;&lt;/p&gt;
        &lt;!-- Create second 4 --&gt;
      &lt;p&gt;&lt;/p&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;&lt;div class=&quot;cat&quot;&gt; … &lt;/div&gt;
        &lt;!-- if more than 4 Close first 4 --&gt;
      &lt;p&gt;&lt;/p&gt;
        &lt;!-- Create second 4 --&gt;
      &lt;p&gt; … &lt;/p&gt;&lt;/div&gt;
  </code></pre>
  <p>I need it to print exactly what is inside the echo statements.</p>