dougao7801 2016-09-11 18:40
浏览 40

检查sql php中下拉列表的值

I have two tables in SQL Server database. One table called matrix has all the values to display in a web table and the other table matrix-dropdowns have the values of the cells that have dropdowns. I want to have different background colors for the cell values of dropdowns in the web table, say if q1, then green color, if q2, yellow color. I could not figure out where to create a function to compare the cell values and return background color accordingly. The code snippet is shown below:

<?php
require_once('include/database.php');

?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>

<section>
    <table id="myTable" class="tablesorter">
    <thead>
    <tr>
     <th>Capacity</th>
     <th>Ownership</th>
     <th>Action</th>
     </tr>
     </thead> 

       <tbody>
        <?php
        $stmt = $conn->prepare("SELECT * FROM MATRIX ORDER BY OBJECTID ASC");
        $stmt ->execute();
        $result = $stmt->fetchAll();
        foreach($result as $row) {
         ?>

          <tr>
          <td><?=$row['Ownership'];?></td>
          <td><?=$row['Capacity'];?></td>
          <td><a href="edit.php?id=<?=$row['OBJECTID'];?>">Edit </a>  </td>

           </tr>
           </tbody>

        <?php
         }
         ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 yolov8边框坐标
    • ¥15 matlab中使用gurobi时报错
    • ¥15 WPF 大屏看板表格背景图片设置
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真