我有一个下拉列表,我希望它只显示数据库中输入的最新数据。
mysql_select_db($database_final, $final);
$query_LatestPO = "SELECT * FROM tbl_po ORDER BY id_po desc limit 1";
$LatestPO = mysql_query($query_LatestPO, $final) or die(mysql_error());
$row_LatestPO = mysql_fetch_assoc($LatestPO);
$totalRows_LatestPO = mysql_num_rows($LatestPO);
这是我的动态下拉列表的代码
<label>PO Number:</label>
<select name="select3" id="select3">
<?php
do {
?>
<option value="<?php echo $row_LatestPO['id_po']?>">
<?php echo $row_LatestPO['po_no']?></option><?php
} while ($row_LatestPO = mysql_fetch_assoc($LatestPO));
$rows = mysql_num_rows($LatestPO);
if($rows > 0) {
mysql_data_seek($LatestPO, 0);
$row_LatestPO = mysql_fetch_assoc($LatestPO);
}
?>
</select>
为什么这不起作用?它显示下拉列表中表格中的所有数据。