<?php
$fenbiaoarticle = '5';//分了多少个文章主表数量,根据你实际的主表分表数量
$unionQuery = '';
for ($i = 0; $i < $fenbiaoarticle-1; $i++) {
if ($i == 0) {
$unionQuery = "select * from {$dbtbpre}ecms_article" . $fenbiaoarticle[$i] . " ";
} else {
$unionQuery .= " union all select * from {$dbtbpre}ecms_article" . $fenbiaoarticle[$i] . " ";
}
}
$unionQuery .= ' order by id desc limit 10';
$sql=$empire->query($unionQuery);
while($r=$empire->fetch($sql)){
?>
<tr>
<td width="67%" height="25">·<a href="<?=$r['titleurl']?>" target="_blank">
<?=esub(stripslashes($r['title']),32)?>
</a></td>
<td width="33%"><div align="center">[<?=date('Y-m-d',$r['newstime'])?>]</div></td>
</tr>
<?php
}
能不能看懂呢?这就是多个多个主表的 |