如何href
从数据库中获取行作为“id”字符串值?换句话说,如何在一个 foreach 中显示多个数组?
如果代码中有任何其他逻辑错误,您也可以指出这一点。
<?php
$query = mysql_query("SELECT `id`, `url` FROM `bse` ORDER BY `id` DESC LIMIT 9");
while ($row = mysql_fetch_array ($query))
$post_id[] = $row['id'];
$rid[] = $row['url'];
}
$array = array(
"pid" => $post_id,
"vid" => $rid,
);
foreach (array_chunk($array["vid"], 3) as $rida) { ?>
<tr>
<?php foreach ($rida as $array["vid"])
{ ?>
<td><div class="a45"><a href="<?php echo $array["pid"]; ?>" title="nim" ><?php
echo $array["vid"];
?>
</a></div></td>
<?php } ?>
</tr>
<?php } ?>
</table>