如何在視圖中將數據庫中的值替換爲另一個值?PHP Mysql替換while循環中的值
讓數據庫說,存儲在數據庫中「類型」的數據是1,但鑑於在我需要更換爲字符串值「住房貸款」
這是我在PHP代碼:
$loans = mysql_query("SELECT * FROM loans");
echo "<table cellspacing='2'>";
echo "<tr><th>ID</th><th>Name</th><th width=70>Type</th><th width=70>Amount</th><th width=70>Duration</th><th>Installment</th><th></th><th></th></tr>";
?>
<form method="post" action="">
<?php
while ($row = mysql_fetch_array($loans)) {
echo "<tr>";
echo "<td>" . $row["loan_id"] . "</td>";
echo "<td>" . $row["name"] . "</td>";
echo "<td>" . $row["type"] . "</td>";
echo "<td>" . $row["amount"] . "</td>";
echo "<td>" . $row["duration"] . "</td>";
echo "<td>" . $row["installment"] . "</td>";
echo "</tr>";
}
echo "</table>";
THX它解決了:) – Kamalisto