如何在mysql php中从数据库中回显一个未选中的选项值
问题描述:
I want to echo or display an "unselected(2nd) option" from the db.
please help!!!
1st(selected) option where it will display the value "ACCEPTED"
<a type="button" class="btn btn-default btn-round btn-md" href="#">
<?php echo $row['status'];?>
</a>
2nd(unselected) option where it will display the value "PENDING"
<a type="button" class="btn btn-default btn-round btn-md" href="#">
*HOW TO ECHO A VALUE IN HERE FROM THE DB?*
</a>
PHP CODE(this is mysql query)
$stmt = $db->prepare('SELECT * FROM blog_members WHERE memberID = :memberID') ;
$stmt->execute(array(':memberID' => $_GET['id']));
$row = $stmt->fetch();
答
I think this is what you are looking for
if ($row['status'] == "PENDING") {
echo '<a type="button" class="btn btn-default btn-round btn-md" href="#">
PENDING
</a>';
} else {
echo '<a type="button" class="btn btn-default btn-round btn-md" href="#">
ACCEPTED
</a>';
}