久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='w18YR'><tr id='w18YR'><dt id='w18YR'><q id='w18YR'><span id='w18YR'><b id='w18YR'><form id='w18YR'><ins id='w18YR'></ins><ul id='w18YR'></ul><sub id='w18YR'></sub></form><legend id='w18YR'></legend><bdo id='w18YR'><pre id='w18YR'><center id='w18YR'></center></pre></bdo></b><th id='w18YR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='w18YR'><tfoot id='w18YR'></tfoot><dl id='w18YR'><fieldset id='w18YR'></fieldset></dl></div>

      <legend id='w18YR'><style id='w18YR'><dir id='w18YR'><q id='w18YR'></q></dir></style></legend>
    1. <small id='w18YR'></small><noframes id='w18YR'>

        <bdo id='w18YR'></bdo><ul id='w18YR'></ul>
      <tfoot id='w18YR'></tfoot>

      1. 單擊按鈕時更新信息表

        Update a table of information on a button click(單擊按鈕時更新信息表)
          <tbody id='cI11f'></tbody>

              <small id='cI11f'></small><noframes id='cI11f'>

              <legend id='cI11f'><style id='cI11f'><dir id='cI11f'><q id='cI11f'></q></dir></style></legend>
              1. <tfoot id='cI11f'></tfoot>

                • <bdo id='cI11f'></bdo><ul id='cI11f'></ul>
                  <i id='cI11f'><tr id='cI11f'><dt id='cI11f'><q id='cI11f'><span id='cI11f'><b id='cI11f'><form id='cI11f'><ins id='cI11f'></ins><ul id='cI11f'></ul><sub id='cI11f'></sub></form><legend id='cI11f'></legend><bdo id='cI11f'><pre id='cI11f'><center id='cI11f'></center></pre></bdo></b><th id='cI11f'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cI11f'><tfoot id='cI11f'></tfoot><dl id='cI11f'><fieldset id='cI11f'></fieldset></dl></div>
                  本文介紹了單擊按鈕時更新信息表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個表格,可以從數據庫中選擇信息并顯示它,我想知道是否有人可以提供代碼讓我通過單擊按鈕來更新列?

                  I have a table which will select information from a database and display it, I'm wondering if anyone can provide a code for me to update a column on the click of a button?

                  示例表:(Access=Boolean)

                  Example Table: (Access=Boolean)

                  ID   -   Name   -   Access
                  ---------------------------
                  1   -   John    -    1
                  ---------------------------
                  2   -   Ben     -    1
                  ---------------------------
                  3   -   Terry   -    0
                  ---------------------------
                  

                  我現有的按鈕基于引導程序,

                  My exisiting button is based on bootstrap,

                      <button type="button" id="passed" class="btn btn-success btn-flat"><i class="fa fa-check"></i></button>
                      <button type="button" id="insufficient" class="btn btn-danger btn-flat"><i class="fa fa-times"></i></button>
                  

                  我希望有這樣的事情,ONCLICK button1 Run $Allowed SQLONCLICK button2 運行 $NotAllowed SQL

                  I was hoping for something like this, ONCLICK button1 Run $Allowed SQL ONCLICK button2 Run $NotAllowed SQL

                  $allowed = mysqli_query($conn," UPDATE users SET Access = "1" WHERE id = '27' ");     
                  $notallowed = mysqli_query($conn," UPDATE users SET Access = "0" WHERE id = '453' ");
                  

                  推薦答案

                  您可以使用帶有 post 方法的表單和帶有命名屬性的提交類型的按鈕,并在條件語句中使用這些按鈕.

                  You can use a form with a post method and a submit type of buttons with named attributes and use those in a conditional statement.

                  即:

                  旁注:我刪除了轉義引號,因為我不確定這些引號是否已經設置在 echo 中.

                  Sidenote: I removed the escaped quotes, as I was not sure if those were already set inside an echo.

                  HTML 表單:

                  <form method="post" action="handler.php">
                  
                      <button type="submit" name="passed" id="passed" class="btn btn-success btn-flat"><i class="fa fa-check"></i></button>
                      <button type="submit" name="insufficient" id="insufficient" class="btn btn-danger btn-flat"><i class="fa fa-times"></i></button>
                  
                  </form>
                  

                  PHP:

                  <?php 
                  
                  // db connection
                  
                  if(isset($_POST['passed'])){
                  
                      $allowed = mysqli_query($conn," UPDATE users SET Access = "1" WHERE id = '27' ");
                  
                  }
                  
                  if(isset($_POST['insufficient'])){
                  
                      $notallowed = mysqli_query($conn," UPDATE users SET Access = "0" WHERE id = '453' ");
                  
                  }
                  

                  • 如果這在任何給定點有任何用戶交互,請務必小心.

                    • Be careful if this has any user interaction at any given point.

                      使用準備好的語句,或 帶有準備好的語句的 PDO它們更安全.

                      腳注:

                      運行 UPDATE 查詢時,最好使用 mysqli_affected_rows() 以獲得絕對真實性.

                      When running an UPDATE query, it's best to use mysqli_affected_rows() for absolute truthness.

                      • http://php.net/manual/en/mysqli.affected-行.php

                      否則,您可能會得到誤報.

                      Otherwise, you may get a false positive.

                      這篇關于單擊按鈕時更新信息表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                      【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調用未定義的函數 mysqli_result::num_rows())
                  PHP Prepared Statement Problems(PHP 準備好的語句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結果)
                  PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                  How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)

                    • <bdo id='uVo4l'></bdo><ul id='uVo4l'></ul>
                    • <legend id='uVo4l'><style id='uVo4l'><dir id='uVo4l'><q id='uVo4l'></q></dir></style></legend>
                      <i id='uVo4l'><tr id='uVo4l'><dt id='uVo4l'><q id='uVo4l'><span id='uVo4l'><b id='uVo4l'><form id='uVo4l'><ins id='uVo4l'></ins><ul id='uVo4l'></ul><sub id='uVo4l'></sub></form><legend id='uVo4l'></legend><bdo id='uVo4l'><pre id='uVo4l'><center id='uVo4l'></center></pre></bdo></b><th id='uVo4l'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='uVo4l'><tfoot id='uVo4l'></tfoot><dl id='uVo4l'><fieldset id='uVo4l'></fieldset></dl></div>

                      <small id='uVo4l'></small><noframes id='uVo4l'>

                        <tfoot id='uVo4l'></tfoot>

                              <tbody id='uVo4l'></tbody>

                          • 主站蜘蛛池模板: 国产欧美一区二区三区久久 | 一区二区三区在线 | 国产片一区二区三区 | 日日日干干干 | 亚洲一区二区三区免费观看 | 久久a久久| 日韩精品一区二区三区视频播放 | 成人一区二区三区视频 | 国产羞羞视频在线观看 | 精品无码久久久久久国产 | 日韩精品一区二区三区老鸭窝 | www国产精品| 美女福利网站 | 日韩三级在线 | 亚洲区视频 | 国产在线精品一区二区 | 国产电影一区二区在线观看 | 国内精品在线视频 | 国产精品国产成人国产三级 | 日韩欧美精品在线 | 在线国产欧美 | 欧美成人a | 日韩精品久久久 | 日韩国产免费观看 | 欧美日韩专区 | 女人牲交视频一级毛片 | 国产玖玖 | 99久久久久久99国产精品免 | 99精品电影| 日韩av一区二区在线观看 | 中文字幕精品视频 | 欧美极品视频在线观看 | 久久久国产一区二区三区 | 久久久久无码国产精品一区 | 麻豆一区二区三区精品视频 | 亚洲免费网址 | 97色在线视频 | 国产欧美一区二区三区日本久久久 | 成人一区二区三区视频 | 精品国产亚洲一区二区三区大结局 | 亚洲一区二区三区免费在线观看 |