如何从表列和更新列显示特定值

时间:2014-04-22 08:13:23

标签: php

我已经建立了一个网页,可以将状态更新为活动,非活动或“NA”。

"N/A" = 0
   active = 1
   inactive = -1

一切正常

因此将它们插入到数据库中:1,0和-1

现在我想创建一个仅显示非活动值的更新页面,换句话说,只显示-1

现在我想更新此内容,就像我已将其插入插入页面

 if($_REQUEST['update']=="Yes")
     {



if($_GET['status']==-1){
$update = mysql_query("update causelist set msg=0  where id='".$_GET['uid']."'");
}elseif($_GET['status']==1){
$update = mysql_query("update causelist set msg=-1, where id='".$_GET['uid']."'");
}elseif($_GET['status']==0){

$update = mysql_query("update causelist set msg=1 where id='".$_GET['uid']."'");
}
    }

   ?>

   <table width="100%" style="table-layout:fixed;">
   <tbody>
   <?php

  $query = mysql_query("select * from causelist where CaseType='A'");

   while($res= mysql_fetch_array($query))
     { ?> 
     <tr >
   <td class="blueh"  width="5px" style="height:40px;">
    <?php echo $res['SNo']; ?>
   </td>
   <td class="purpleh"  width="25px" style="height:40px;">
   <font size="3" style="color:black;line-height:100%;font-family:'Calibri';">
    <?php echo $res['CaseNo']; ?>
   </font>

       </td>
       <td class="purpleh"  width="25px" style=" width=20px;height:40px;">
    <font size="3" style="color:black;line-height:100%;font-family:'Calibri';">
    <?php echo $res['CouncilName']; ?>
    </font>
    </td>
    <td class= "purpleh" width="25px" style="width=20px;height:40px;">
    <font size="3" style="color:black;line-height:100%;font-family:'Calibri';">
    <?php echo $res['resadv']; ?>
    </font>
    </td> 
      <td class="redh" width="3px" style=";line- height:50%;">
     <?php if($res['msg']==1) 
     {
 //echo "Active"; 
  echo "<img src='images/r.png'/>";
   }
  elseif($res['msg']==-1)

    {

  //echo "Inactive";
  echo "<img src='images/take.png'/>";

      }

  elseif($res['msg']==0)

   { 
  //echo "NA"; 
   echo "<img src='images/none.png'/>";

   } ?></td>
  <td class="redh" width="3px" style="center;height:5px;line-height:50%;">
  <a href="case.php?uid=<?php echo $res['id']; ?>&update=Yes&status=
  <?php echo $res['msg']; ?  >">
  <img src="images/p2.png"/></a></td>
   </tr>
  <?php }}?>
</tbody>
</table>

0 个答案:

没有答案