我已成功将数据从mySql提取到html电子邮件的消息中。但是经过几次尝试,我无法在第10条记录之后添加两条中断线。任何帮助都会很棒。

$sorc325sql = "Select * ".$sorc325sql2;
echo "<br>325sql=".$sorc325sql."<br><br>";
$sorc325res = mysqli_query($connectXXX, $sorc325sql) or die(mysqli_error($connectXXX));
if  (mysqli_num_rows($sorc325res) < 1) {
        $display_block = "<p><em>No topics exist.</em></p>";
    } else {
        while ($sorc325row = mysqli_fetch_array($sorc325res)) {
          $sorc325arycustctr++;
          $message .= $sorc325row['progName'].', ';
          }
    }

最佳答案

使用Mark B的想法,您需要将其添加到当前的$sorc325arycustctr++;行中

$sorc325sql = "Select * ".$sorc325sql2;
echo "<br>325sql=".$sorc325sql."<br><br>";
$sorc325res = mysqli_query($connectXXX, $sorc325sql)
                   or die(mysqli_error($connectXXX));

if  (mysqli_num_rows($sorc325res) < 1) {
    $display_block = "<p><em>No topics exist.</em></p>";
} else {

    $sorc325arycustctr = 0;

    while ($sorc325row = mysqli_fetch_array($sorc325res)) {
       $sorc325arycustctr++;
       if (! ($sorc325arycustctr % 10)) {
           $message .= '<br>';
       }
       $message .= $sorc325row['progName'].', ';
    }
}

10-05 19:18