批准后更改状态

时间:2014-04-14 16:54:27

标签: php

我有一个管理区域,用于批准员工部门发送的工作计划详细信息。在管理员批准工作计划之后,数据库表中行'status'的所有4列需要从0更改为1.但是它没有发生。这是我的代码

<?php
include("includes/connect.php");
$id=$_GET['id'];
$sql="UPDATE workplan_detail set status[]='1' where id='$id'";
$query=mysql_query($sql);
if(isset($query)){
    //$div=$_SESSION['dept'];
    //$sql2="UPDATE users set status='1' where Division='$div'";
    //$query1=mysql_query($sql2);
    if(isset($query1)){
        $_SESSION['msg']='Your work plan has been approved';
    }
    echo "<script>window.location='admin_workplan.php?msg=success'</script>";
}
?>

以及我的发现部分

<?php
$msg=$_GET['msg'];
if($msg=='success')
    echo "Approval successfull";
?>
<p>
  <?php
  if(!isset($msg))
  { 
?>

<?php
include ('includes/connect.php');

    $query = "SELECT * FROM workplan_detail";
    $sql1 = mysql_query($query);


        $count = 0;

        $division = "";
        $chief = "";
        $aperiod = "";
        $workmonth = "";
        $activityNames = array();
        $workunits = array();
        $workweightage = array();
        $percent100 = array();
        $percent75= array();
        $percent50 = array();
        $percentless50 = array();


        while($row = mysql_fetch_assoc($sql1)){
            $division = $row['division_name'];
            $chief = $row['division_chief'];
            $aperiod = $row['Period'];
            $workmonth = $row['Month'];
            $activityNames[$count] = $row['activity_name'];
            $workunits[$count] = $row['Unit'];
            $workweightage[$count] = $row['Weightage'];
            $percent100[$count] = $row['per_100'];
            $percent75[$count]= $row['per_75'];
            $percent50[$count] = $row['per_50'];
            $percentless50[$count] = $row['per_less50'];


            ++$count;
        }

  }
    ?>

                <table width='250' height='50' border='0' align='left' >

                    <tr>
                        <td> <p>Division Name:</p> </td>
                        <td  style='border:1px solid white;'><?php echo $division; ?></td>
                    </tr>
                    <tr>
                        <td><p>Division Chief: </p></td>
                        <td style='border:1px solid white;'><?php echo $chief;?></td>
                    </tr>
                    <tr>  
                        <td><p> Period:  </p> </td>
                        <td style='border:1px solid white;'><?php echo $aperiod; ?></td>
                    </tr>
                    <tr>
                        <td><p> Month:</p>  </td>
                        <td style='border:1px solid white;'><?php echo $workmonth;?></td>
                    </tr>





    <table border='1' cellpadding='0' cellspacing='1' align='center' font align='center' style='width:900px;border-spacing:0px; text-align: center; position:relative; top:20px;'>
                        <tr>
                            <td rowspan='2' height='50' width='25' style='border: solid white;'>SN</td>
                            <td rowspan='2' width='200' style='border: solid white;'>Activity Name</td>
                            <td rowspan='2' width='100' style='border: solid white;'>Unit</td>
                            <td rowspan='2' width='100' style='border: solid white;'>Weightage</td>
                            <td colspan='4' height='30' width='300' style='border: solid white;'>Performance Indicators (Percentage)</td>
                        </tr>
                        <tr>
                            <td height='25%' style='border: solid white;'> 100 </td>
                            <td height='25%' style='border: solid white;'> 75 </td>
                            <td height='25%' style='border: solid white;'> 50 </td>
                            <td height='25%' style='border: solid white;'> <50 </td>
                        </tr>

                              <tr>
                              <td style='border:1px solid white;'>1</td>
                             <td style='border:1px solid white;'><?php echo $activityNames[0];?></td>
                              <td style='border:1px solid white;'><?php echo $workunits[0];?></td>
                              <td style='border:1px solid white;'><?php echo $workweightage[0];?></td>
                              <td style='border:1px solid white;'><?php echo $percent100[0];?></td>
                              <td style='border:1px solid white;'><?php echo $percent75[0];?></td>
                              <td style='border:1px solid white;'><?php echo $percent50[0];?></td>
                              <td style='border:1px solid white;'><?php echo $percentless50[0];?></td>
                              </tr>

                              <tr>
                              <td style='border:1px solid white;'>2</td>
                             <td style='border:1px solid white;'><?php echo $activityNames[1];?></td>
                              <td style='border:1px solid white;'><?php echo $workunits[1];?></td>
                              <td style='border:1px solid white;'><?php echo $workweightage[1];?></td>
                              <td style='border:1px solid white;'><?php echo $percent100[1];?></td>
                              <td style='border:1px solid white;'><?php echo $percent75[1];?></td>
                              <td style='border:1px solid white;'><?php echo $percent50[1];?></td>
                              <td style='border:1px solid white;'><?php echo $percentless50[1];?></td>
                              </tr>

                              <tr>
                              <td style='border:1px solid white;'>3</td>
                             <td style='border:1px solid white;'><?php echo $activityNames[2];?></td>
                              <td style='border:1px solid white;'><?php echo $workunits[2];?></td>
                              <td style='border:1px solid white;'><?php echo $workweightage[2];?></td>
                              <td style='border:1px solid white;'><?php echo $percent100[2];?></td>
                              <td style='border:1px solid white;'><?php echo $percent75[2];?></td>
                              <td style='border:1px solid white;'><?php echo $percent50[2];?></td>
                              <td style='border:1px solid white;'><?php echo $percentless50[2];?></td>
                              </tr>


                            </table
                            ></p>
                            <p>&nbsp; </p>
                            <a href='approval.php?id=$row[id]'>Approve Workplan</a>


Here's the screen shot of my database table

访问http://imgur.com/a/WtMzU

0 个答案:

没有答案