How to get PHP to do the same thing my Cold Fusion does
<p>For those of you who have seen my previous questions, here is the problem. I am converting some Cold Fusion into PHP. Here is the Cold Fusion that works great.   </p>

<pre><code> &lt;cfset ColCount = 0&gt;
        &lt;cfloop query="getArt"&gt;
            &lt;cfset ColCount = ColCount + 1&gt;
            &lt;cfif ColCount is 1&gt;
                &lt;div id="clear"&gt;&lt;/div&gt;
            &lt;/cfif&gt;
            &lt;div id="thumb" onClick="window.location='gallery_detail.cfm?AID=#AID#';" title="Enlarge"&gt;
                &lt;div id="thumb_container"&gt;
                    &lt;a href="gallery_detail.cfm?AID=#AID#" &gt;&lt;img src="/#ThumbFilePath#" alt="Enlarge" border="0"&gt;&lt;/a&gt;
                    &lt;div id="name_spacer"&gt;&lt;/div&gt;
                    &lt;div id="thumbdesc"&gt;
                        #Title#
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;cfif ColCount LT 4&gt;&lt;/cfif&gt;
            &lt;cfif ColCount is 4&gt;
                &lt;cfset ColCount = 0&gt;
            &lt;/cfif&gt;
        &lt;/cfloop&gt;
</code></pre>

<p>Here is the PHP that I am trying to get to do the same thing the Cold Fusion does.</p>

<pre><code>&lt;?php  
$dbname = 'pdartist2';  
$table = 'artwork';  
// query  
$result = mysql_query("SELECT AID, ThumbFilePath, Title, DisplayOrder FROM artwork    where SCID = '$SCID' ") or die(mysql_error());  
while($row = mysql_fetch_row($result))  
{  
$colCount = 0;  
foreach($row as $cell) {  
  $colCount++;  
  if ColCount is 1
  echo "&lt;div id="clear"&gt;&lt;/div&gt;";
  echo "&lt;div id="thumb" onClick="window.location='gallery_detail.php?AID=$AID';" title="Enlarge"&gt;";
      echo "&lt;div id="thumb_container"&gt;";
          &lt;a href="gallery_detail.php?AID=$AID" &gt;&lt;img src="/$ThumbFilePath" alt="Enlarge" border="0"&gt;&lt;/a&gt;
      echo "&lt;div id="name_spacer"&gt;&lt;/div&gt;";
      echo "&lt;div id="thumbdesc"&gt;";
              $Title
      echo "&lt;/div&gt;";
      echo "&lt;/div&gt;";
      echo "&lt;/div&gt;";

    }  
}  
 mysql_free_result($result);  

?&gt;
</code></pre>

<p>I know that this somewhat rough, but you get the idea. Obviously, Cold Fusion and PHP handle HTML and SQL quite differently. I wouldn't make the change unless I had too, alas I do.</p>
