如何在查看期间将数据库中的值替换为另一个值?
假设在数据库中,存储在数据库中的“类型”数据为 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>";