填充db时禁用按钮javascript上为空时启用

填充db时禁用按钮javascript上为空时启用,javascript,php,html,mysql,select,Javascript,Php,Html,Mysql,Select,我的数据库表名为material 材料: mat_id mat_name status 1 bolts 2 steel approved 当状态为“已批准”时,如何使我的按钮或href链接禁用 在我的html表格上 比如: 我的html/php代码: <?php $resource=mysql_query("Select * from material",$con); while

我的数据库表名为material 材料:

mat_id    mat_name     status
1          bolts         
2          steel      approved
当状态为“已批准”时,如何使我的按钮或href链接禁用 在我的html表格上

比如:

我的html/php代码:

    <?php 


    $resource=mysql_query("Select * from material",$con);

    while($result2=mysql_fetch_array($resource))
        { 

        ?>
     <tr>
    <th>option</th>
    <th>mat_id</th>
    <th>material name</th>
    </tr>

     <tr>
  <td align="center">
<?php 
$id = $rows['reqraw_id'];
if($rows['status']=="")
{
   echo '<a href="addstockout.php?id=$id" > Update </a>';
} ?>
</td>
    <td><?php echo $result2['mat_id']; ?></td>
    <td><?php echo $result2['mat_name']; ?></td>
    </tr>
        <?php };?>

选项
材料id
材料名称
这条线上有个问题

echo '<a href="addstockout.php?id=$id" > Update </a>';
echo';

它无法从数据库中获取id数组。

我认为这应该可以做到:

而不是

<td>button</td>
按钮
付诸表决:


。。。
按钮
按钮
...
如果($result2['status']==”或$result2['status']==NULL)
{
回声“点击我!”;
}否则{
回声“点击我!”;
}

OP希望在
status
null
时启用它。IE:
如果($result2['status']==NULL)
你应该把这个问题作为一个单独的问题来问,而不是改变原来的问题,但是<代码>回显“”
<td>button</td>
<?php

echo '<td><button ';
if(!($result2['status']==="approved"))
{
   echo 'disabled="true"';
}
echo '>Click</button></td>';

?>
...
<?php if($result2['status'] == 'approved') { ?>
    <td><button disabled="true">Button</button></td>         
<?php 
} else{ ?>
    <td><button>Button</button></td>
 <?php } ?>

...
if($result2['status']=="" OR $result2['status']===NULL)
{
   echo '<button type="button">Click Me!</button>';
}else{
   echo '<button type="button" disabled>Click Me!</button>';
}
<td><?php echo ($result2['status']===NULL)?"button here":"disabled"; ?></td>