我目前有 2 个表格,如下所示:
这 2 个表的代码如下所示:
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">Mail_ID </div></th>
<th width="91"> <div align="center">Status </div></th>
<th width="91"> <div align="center">Datum </div></th>
</tr>
<?php
$j = 0;
while($objResult2 = mysql_fetch_array($objQuery2))
{
$j++;
?>
<tr>
<td><div align="center"><?=$objResult2["Mail_ID"];?> </div></td>
<td><div align="center"><?=$objResult2["Status"];?> </div></td>
<td><div align="center"><?=$objResult2["Datum"];?> </div></td>
</tr>
<?php
}
?>
</table>
<br/>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">ID </div></th>
<th width="91"> <div align="center">Titel </div></th>
<th width="91"> <div align="center">Subscribe </div></th>
<th width="91"> <div align="center">Unsubscribe </div></th>
</tr>
<?php for ($i = 0; $objResult1 = mysql_fetch_array($objQuery1); $i++) : ?>
<tr>
<td><div align="center"><?=$objResult1["ID"];?><input type="hidden" name="mailid[]" value="<?=$objResult1["ID"];?>"> </div></td>
<td><div align="center"><?=$objResult1["Titel"];?> </div></td>
<td><div align="center"><input type="radio" name="sub[<?php echo $i; ?>]" value="10"> </div></td>
<td><div align="center"><input type="radio" name="sub[<?php echo $i; ?>]" value="90"> </div></td>
</tr>
<?php endfor; ?>
</table>
查询和变量如下所示:
$strSQL1 = "SELECT ID, Titel FROM Mail";
$strSQL2 = "SELECT * FROM Subscriptions,
(SELECT MAX(ID) as ids, Mail_ID FROM Subscriptions
WHERE Klant_ID = '".$_GET["ID"]."' GROUP BY Mail_ID) table2
WHERE ID=table2.ids";
$objQuery1 = mysql_query($strSQL1);
$objQuery2 = mysql_query($strSQL2);
现在我想合并这两个表,如下所示:
我无法让它工作,因为我尝试的所有东西都混合了所有东西,因为那里有 2 个循环。我希望你们能理解我的问题,我添加了尽可能多的信息和图片以使一切清楚^^如果您仍有问题,请提出评论。欢迎任何帮助!