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

        <bdo id='kMkph'></bdo><ul id='kMkph'></ul>
      <legend id='kMkph'><style id='kMkph'><dir id='kMkph'><q id='kMkph'></q></dir></style></legend>
    1. <small id='kMkph'></small><noframes id='kMkph'>

      <i id='kMkph'><tr id='kMkph'><dt id='kMkph'><q id='kMkph'><span id='kMkph'><b id='kMkph'><form id='kMkph'><ins id='kMkph'></ins><ul id='kMkph'></ul><sub id='kMkph'></sub></form><legend id='kMkph'></legend><bdo id='kMkph'><pre id='kMkph'><center id='kMkph'></center></pre></bdo></b><th id='kMkph'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kMkph'><tfoot id='kMkph'></tfoot><dl id='kMkph'><fieldset id='kMkph'></fieldset></dl></div>
    2. <tfoot id='kMkph'></tfoot>
      1. PHP 多輸入搜索

        PHP Multiple input search(PHP 多輸入搜索)
        <legend id='SFcCo'><style id='SFcCo'><dir id='SFcCo'><q id='SFcCo'></q></dir></style></legend>
        <i id='SFcCo'><tr id='SFcCo'><dt id='SFcCo'><q id='SFcCo'><span id='SFcCo'><b id='SFcCo'><form id='SFcCo'><ins id='SFcCo'></ins><ul id='SFcCo'></ul><sub id='SFcCo'></sub></form><legend id='SFcCo'></legend><bdo id='SFcCo'><pre id='SFcCo'><center id='SFcCo'></center></pre></bdo></b><th id='SFcCo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SFcCo'><tfoot id='SFcCo'></tfoot><dl id='SFcCo'><fieldset id='SFcCo'></fieldset></dl></div>

            <tfoot id='SFcCo'></tfoot>

            • <bdo id='SFcCo'></bdo><ul id='SFcCo'></ul>
                <tbody id='SFcCo'></tbody>

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

                • 本文介紹了PHP 多輸入搜索的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我目前正在研究一些 PHP 并且我有 3 個文本輸入.在 MySQL 數據庫中搜索這些值,并應返回與輸入條件相對應的任何數量的結果.

                  這里是搜索表單:

                  <字段集><legend>搜索</legend><div class='container'><label for='C_Name' >企業名稱:</label><br/><input type='text' name='C_Name' id='C_Name' maxlength="50"/><br/><label for='C_County' >城市:</label><br/><input type='text' name='C_County' id='C_County' maxlength="50"/><br/><label for='Job_Type' >工作類型:</label><br/><input type='text' name='Job_Type' id='Job_Type' maxlength="50"/><br/>

                  <div class='container'><input type='submit' name='Submit' value='Search'/>

                  </fieldset></表單>

                  這是它在動作中鏈接的 PHP 腳本:

                   0){//附加條件$query .= " WHERE " .內爆 (' AND ', $conditions);//您可以更改為或",但我建議應用累積過濾器}$result = mysqli_query($mysqli_link, $query) 或 die(mysql_error());mysqli_close($mysqli_link);if(isset($_POST['submit'])) {while($row = mysqli_fetch_assoc($result)) {$C_Name = $row['C_Name'];$C_StreetNumber = $row['C_StreetNumber'];$C_StreetName = $row['C_StreetName'];$C_Postcode = $row['C_Postcode'];$C_County = $row['C_County'];$C_Tele = $row['C_Tele'];$C_Website = $row['C_Website'];$Contact_Forename = $row['Contact_Forename'];$Contact_Surname = $row['Contact_Surname'];$Contact_Email = $row['Contact_Email'];$Job_Type = $row['Job_Type'];$Job_Price = $row['Job_Price'];echo "<b>名稱:$C_Name</b><br>街道號碼:$C_StreetNumber<br>街道名稱:$C_StreetName<br>郵政編碼:$C_Postcode<br>縣:$C_County<電話>$C_Tele<br>網站:$C_Website<br>聯系人姓名:$Contact_Forename $Contact_Surname<br>電子郵件:$Contact_Email<br>工作類型:$Job_Type<br>工作價格<>>工作價格:$Job>;}}}?>

                  由于某種原因它返回有

                  <塊引用>

                  意外的文件結尾

                  " 但是我已經檢查了代碼并且當我在最后添加另一個 '}' 時,所有代碼都被正確關閉(從我所看到的)腳本根本不返回任何內容.任何人都知道為什么這會發生嗎?

                  來源:使用表單中的多個字段搜索 MySQL 數據庫

                  解決方案

                  因為忘記關閉

                  if(isset($_POST['submit'])) {//你沒有關閉條件

                  文件末尾

                  只需在文件末尾添加 }

                  I'm currently working on a bit of PHP and I've 3 text inputs. The values are searched in the MySQL database and should return whatever amount of results correspond with the entered criteria.

                  here is the search form:

                  <form id='SearchPersonal' method='post' action='businessUsersSearch.php' accept-charset='UTF-8'>
                  <fieldset >
                  <legend>Search</legend>
                  
                  <div class='container'>
                  <label for='C_Name' >Business Name: </label><br/>
                  <input type='text' name='C_Name' id='C_Name' maxlength="50" /><br/>
                  <label for='C_County' >City: </label><br/>
                  <input type='text' name='C_County' id='C_County' maxlength="50" /><br/>
                  <label for='Job_Type' >Job Type: </label><br/>
                  <input type='text' name='Job_Type' id='Job_Type' maxlength="50" /><br/>
                  </div>
                  
                  <div class='container'>
                  <input type='submit' name='Submit' value='Search' />
                  </div>
                  </fieldset>
                  </form>
                  

                  Here is the PHP script it links too in the action:

                  <?php
                  
                       $mysqli_link = mysqli_connect("server", "database", "pass", "user");
                      // Check connection
                      if (mysqli_connect_errno()) {
                        echo "Failed to connect to MySQL: " . mysqli_connect_error();
                      }
                  
                      if(isset($_POST['submit'])) {
                      // define the list of fields
                       $fields = array('C_Name', 'C_County', 'Job_Type');
                      $conditions = array();
                  
                  
                  // loop through the defined fields
                  foreach($fields as $field){
                      // if the field is set and not empty
                      if(isset($_POST[$field]) && $_POST[$field] != '') {
                          // create a new condition while escaping the value inputed by the user (SQL Injection)
                          $conditions[] = "'$field' LIKE '%" . mysqli_real_escape_string($mysqli_link, $_POST[$field]) . "%'";
                  }
                  }
                  
                  // builds the query
                  $query = "SELECT C_Name, C_StreetNumber, C_StreetName, C_Postcode, C_County, C_Tele, C_Website, Contact_Forename, Contact_Surname, Contact_Email, Jobs.Job_Type, Jobs.Job_Price FROM Company INNER JOIN Jobs ON Company.Company_ID = Jobs.Company_ID";
                  // if there are conditions defined
                  if(count($conditions) > 0) {
                      // append the conditions
                      $query .= " WHERE " . implode (' AND ', $conditions); // you can change to 'OR', but I suggest to apply the filters cumulative
                  }
                  
                  $result = mysqli_query($mysqli_link, $query) or die(mysql_error());
                  
                  mysqli_close($mysqli_link);
                  
                  
                      if(isset($_POST['submit'])) {
                          while($row = mysqli_fetch_assoc($result)) {
                          $C_Name = $row['C_Name'];
                          $C_StreetNumber = $row['C_StreetNumber'];
                          $C_StreetName = $row['C_StreetName'];
                          $C_Postcode = $row['C_Postcode'];
                          $C_County = $row['C_County'];
                          $C_Tele = $row['C_Tele'];
                          $C_Website = $row['C_Website'];
                          $Contact_Forename = $row['Contact_Forename'];
                          $Contact_Surname = $row['Contact_Surname'];
                          $Contact_Email = $row['Contact_Email'];
                          $Job_Type = $row['Job_Type'];
                          $Job_Price = $row['Job_Price'];
                  
                  echo "<b>Name: $C_Name</b><br>Street Number: $C_StreetNumber<br>Street Name: $C_StreetName<br>Postcode: $C_Postcode<br>County: $C_County<br>Telephone: $C_Tele<br>Website: $C_Website<br>Contact Name: $Contact_Forename $Contact_Surname<br>Email: $Contact_Email<br>Job Type: $Job_Type<br>Job Price: $Job_Price<hr><br>";
                          }
                      }   
                  }
                  
                  ?>
                  

                  For some reason it is returning that there is "

                  unexpected end of file

                  " however I've checked the code and all the codes is closed off correctly (from what I can see) when I add another '}' in at the end the script doesn't return anything at all. Anyone know why this would be happening?

                  Source: Search MySQL Database with Multiple Fields in a Form

                  解決方案

                  Because you forget to close

                  if(isset($_POST['submit'])) {// you not close the condition
                  

                  At the end of your file

                  Just add } at end of your file

                  這篇關于PHP 多輸入搜索的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

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

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

                • <legend id='cdJiV'><style id='cdJiV'><dir id='cdJiV'><q id='cdJiV'></q></dir></style></legend>

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

                    1. 主站蜘蛛池模板: 99pao成人国产永久免费视频 | 日韩精品在线一区 | 羞羞视频网站免费观看 | 午夜亚洲| 久久精品一区 | 日韩欧美一区二区三区 | 91成人小视频| 国产精品污www一区二区三区 | 免费黄色网址视频 | 欧美二区在线 | 精品久久久久一区二区国产 | 欧美不卡网站 | 在线观看中文字幕 | 中文在线一区二区 | 国产成人精品一区二区三区视频 | 97操操| 亚洲精品一区二区在线观看 | 精品影院 | 激情欧美日韩一区二区 | 91精品国产综合久久久久久丝袜 | 欧美日韩亚洲国产综合 | 久久黄色精品视频 | 亚洲男人的天堂网站 | 久久国产亚洲精品 | 狠狠色狠狠色综合日日92 | 国产日本精品视频 | 在线中文字幕视频 | 欧美日韩三区 | 亚洲毛片一区二区 | 精品免费国产视频 | 在线成人福利 | 国产精品一区二区三区久久 | 免费网站国产 | 亚洲综合一区二区三区 | 在线播放国产一区二区三区 | 亚洲国产一区在线 | 久草热8精品视频在线观看 午夜伦4480yy私人影院 | 你懂的av| 婷婷激情在线 | 精品久久中文 | 亚洲 欧美 日韩在线 |