在下面的代码部分。我正在检查我的$email_count
并输出两件事之一。这工作正常。问题出在while循环中。它不会回显第一条记录。
// Get existing emails in system
$email_data = mysql_query("SELECT * FROM `massmail`");
$row2 =mysql_fetch_array($email_data);
$email_count = mysql_num_rows($email_data);
// Get the campaign name for existing emails
$latest_campaign = $row2['campaign_id'];
$latest_data = mysql_query("SELECT * FROM campaign WHERE `id`='$latest_campaign'");
$latest_row = mysql_fetch_array($latest_data);
$latest_name= $latest_row['name'];
// Display Options depending on availability of emails,
if($email_count ==0){
echo "upload new file";
}else{
echo "<span class=\"text_1\">The following <strong>".$email_count."</strong> emails are in the system for <strong>".$latest_name."</strong> campaign.<br><br>";
echo "<div class=\"rounded-corners1\" id=\"latest_emails\" align=\"left\" style=\"overflow: auto; height: 200px; width:250px; \" >";
// THIS IS WHERE I OUTPUT TO SCREEN BUT THE FIRST RECORD DOESN'T OUTPUT.
while($row2 = mysql_fetch_array($email_data)){
echo $row2['email'].'<br/>';
}
echo "<br/></span></div><br/>";
?>
<table width="600" border="0" cellspacing="10" cellpadding="10">
<tr>
<td width="50%" align="center" valign="top" bgcolor="#336699" class="rounded-corners1" ><span class="white_text">Delete Existing Emails and Upload New File for<br />
<strong><br />
<?php echo $campaign_selected; ?></strong></span><br />
<br />
<form id="form1" name="form1" method="post" action='<?php echo $_SERVER['PHP_SELF']; ?>'>
<input type="hidden" name="campaign_id" id="campaign_id" value='<?php echo $campaign_id; ?>' />
<input type="submit" name="submit" id="submit" onclick="return confirm('Are you sure you want to delete the existing list?');" value="Continue >>" />
<br />
</form>
</td>
<td align="center" valign="top" bgcolor="#336666" class="rounded-corners1" >
<form id="form1" name="form1" method="post" action="mm_send_main_3.php">
<span class="white_text">Re-Send Message to<br />
the above list for<br />
<strong><br /><?php echo $latest_name; ?></strong></span><br />
<br />
<input type="hidden" name="campaign_id" id="campaign_id" value='<?php echo $latest_campaign; ?>' />
<input type="submit" name="button2" id="button2" onclick="return confirm('Are you sure you want to process the existing list?');" value="Continue >>" />
<br />
</form>
</td>
</tr>
</table>
<?php
};
?>