如果状态为未付款,我只想更改文本的颜色。
$query = mysql_query("SELECT * FROM bill_record");
while($row = mysql_fetch_array($query)){
echo $row['bill_id'];
echo "<p>".$row['status']."</p>"; // Status has a paid and unpaid
}
答案 0 :(得分:0)
<?php
$query = mysql_query("SELECT * FROM bill_record");
while($row = mysql_fetch_array($query)) {
echo $row['bill_id'];
if ($row['status'] == 'unpaid') {
echo "<p style=\"color: red\">".$row['status']."</p>";
}
}
答案 1 :(得分:0)
我会添加一个else语句或付费值:
if ($row['status'] == 'unpaid') {
echo "<p style=\"color: red\">".$row['status']."</p>";
} else {
echo "<p>".$row['status']."</p>";
}