douju1953 2014-09-17 19:15
浏览 59
已采纳

如何在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(); 
  • 写回答

1条回答 默认 最新

  • du0173 2014-09-17 20:38
    关注

    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>';
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签)
  • ¥50 sft下载大文阻塞卡死
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失
  • ¥15 springboot+vue 集成keycloak sso到阿里云
  • ¥15 win7系统进入桌面过一秒后突然黑屏
  • ¥30 backtrader对于期货交易的现金和资产计算的问题