I have a while loop. It is supposed to loop through the database table and output the results found, which it does fine. However, it also duplicates the HTML in the while loop (outputting it twice, once in reverse??).
SEE:
1) Jazzminder Soundscape 2) 3) 1) 2) Jazzminder Dandelion 3)
SHOULD READ:
1) Jazzminder Soundscape 2) Jazzminder Dandelion 3)
I've tried tweaking and rewriting the code, but I can't isolate the problem. I've not had this problem before.
This is the block of code:
<p> <a href="promote_next_step.php?promote=<?php echo $_GET['promote']?>">
<strong> [More To Next Step]</strong></a></p>
<strong><font color="gray">Included so far:</font></strong><br/>
<?php
$sql2="SELECT * FROM `promote_track_lists` WHERE `promo_title`='". $_GET['promote1']."'";
$result2=mysql_query($sql2);
while($row2 = mysql_fetch_assoc($result2)){
?>
1) <font color="orange"><strong><?php echo $row2['artist_name1'] ?> <?php echo $row2['track_title1'] ?></strong></font>
2) <font color="orange"><strong><?php echo $row2['artist_name2'] ?> <?php echo $row2['track_title2'] ?></strong></font>
3) <font color="orange"><strong><?php echo $row2['artist_name3'] ?> <?php echo $row2['track_title3'] ?></strong></font>
<?php
}
?>
Thanks for the replies!! The thing is, I have another page which pulls the information from the database just fine:
if (isset ($_GET['promote1']) === true) {
$sql3="SELECT * FROM `promote_track_lists` where `promo_title` ='".$_GET['promote1']."' ";
$result3= mysql_query ($sql3);
while ($row3 = mysql_fetch_assoc ($result3)) {
?>
<div id="promotion_files">
<!------- track1 ------->
<?php if ($row3['iframe1']) {?>
<div class="promotion_track_name"><strong><?php echo $row3['artist_name1'] ?>-<?php echo $row3['track_title1'] ?></strong></div>
<?php echo $row3['iframe1']?>
<?php
if (isset ($_POST['submit'])===true && empty ($_POST['feedback']) === false) {
?>
<a href="mp3_download.php?promote1=<?php echo $row['title'] ?>"><img src='images/design images/iPodDownload.png' /></a>
<?php
}
}
?>
<!------- track2 ------->
It does this 20 times without problem, but for some reason on the other page it loops over the HTML and outputs (just the html) twice. I've tried to work the database so that entries are completely unique from one another, but so that everything can be pulled with one query. ...If that makes sense.