how to get something to display only once in a while loop
- by Matt Nathanson
I've got a mysql query running and it checks to see if an iterator is equal to 1, then display this div title...
if ($this->dliterator == 1) {echo "<div class='clientsection' id='downloads'>Downloads</div><br/>";};
The problem is, is that the dl iterator may not necessarily start at 1. (it is directly related to a downloadid from the database).
How can I get this to display only for the first time through the loop ONLY?
while ($row = mysql_fetch_assoc($result)) {
if ($row['download'] != null){
if ($this->dliterator == 1) {echo "<div class='clientsection' id='downloads'>Downloads</div><br/>";};
if ($editDownload == 1) {
echo "<div class='clientlink' style='margin-top: 15px;'>";
echo "<input name='downloads[$this->dliterator][name]' type='text' id='download$this->dliterator' value='" . $row['download'] . "'/>";
echo "<input name='downloads[$this->dliterator][title]' type='text' id='downloadtitle$this->dliterator' value='" . $row['downloadtitle'] . "'/>";
echo "<img class='removelink' src='/images/deletelink.png' width='15' />";
echo "<input id='downloadid' name='downloads[$this->dliterator][id]' type='hidden' value='".$row['downloadid']."' style='display: none'/>";
echo "<br/><img id='uploaddownload$uploaditerator' class='uploaddownload' src='../images/upload.png' width='80'/>";
echo "</div>";
};
};
$this->dliterator++;
$uploaditerator++;
};