为什么不是';t使用以下代码插入数据库中的值


Why isn't the value inserted in the database using following code?

我正在尝试提交一个表单并在Status表中插入一个值。但它不起作用。里面出了什么问题?

表名为"Status",最后一个列名为"Votes",我想在其中插入值。我认为查询没有运行,因为它没有响应"完成"。

这是代码:

for($x = 0; $x < $arrlength; $x++) {
$ids=$idsorted[$x];
$sts=$stsorted[$x];
$profilenamearray=array();
$idnamequery="SELECT Name FROM signup WHERE Email='$ids'";
$idnamequeryrun=mysqli_query($mysqls, $idnamequery);
$rowidname=mysqli_fetch_assoc($idnamequeryrun);
$profilenamearray[]=$rowidname["Name"];
  ?>
          <h4 style="font-family:Arial, Helvetica, sans-serif; color: #008080; margin: 0px;"> 
          <?php echo $profilenamearray[0];
          ?> </h4>
          <p class="updates"><?php echo $sts; 
          $votequeryrun="";
          if (isset($_REQUEST['submitbutton']))
          {
                $votecheck="SELECT Votes FROM status WHERE statusupdate='$sts'";
                $votecheckrun=mysqli_query($mysqls, $votecheck);
                $rowvote=mysqli_fetch_assoc($votecheckrun);
                $nofvotes=$rowvote["Votes"];
                $nofvotesN=$nofvotes+1;
                echo $nofvotesN;
                    $votequery="INSERT INTO status(Votes) VALUES('$nofvotesN') WHERE statusupdate='$sts'";
                    $votequeryrun=mysqli_query($mysqls, $votequery);
                    if($votequeryrun)
                    {
                        echo "done";
                        header("Location: welcomehome.php");
                    }
            }
          ?></p>
  <form name="votes" method="post" action="">
         <input type="submit" name="submitbutton">Vote</input>
        </form>

          <hr>
          <?php
}
?>

如果使用WHERE子句,则可能需要使用UPDATE。INSERT添加了一行新行,因此没有必要使用where子句。