Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将筛选器添加到我的表中_Php_Jquery_Mysql - Fatal编程技术网

Php 如何将筛选器添加到我的表中

Php 如何将筛选器添加到我的表中,php,jquery,mysql,Php,Jquery,Mysql,我想知道是否有可能添加两个过滤器(下拉)到我的详细信息页面。正如您在图片中看到的,我得到了一个详细页面,其中显示了来自数据库的信息。现在我想添加两个过滤器,一个过滤stad(城市)和一个过滤provincie(州) 下拉菜单必须根据stad(城市)和provincie(州)表格行中的值添加其值。选择stad(城市)或provincie(州)时,仅显示居住在所选城市或州的人员 <?php $servername = "localhost"; $username = "root"; $pas

我想知道是否有可能添加两个过滤器(下拉)到我的详细信息页面。正如您在图片中看到的,我得到了一个详细页面,其中显示了来自数据库的信息。现在我想添加两个过滤器,一个过滤stad(城市)和一个过滤provincie(州)

下拉菜单必须根据stad(城市)和provincie(州)表格行中的值添加其值。选择stad(城市)或provincie(州)时,仅显示居住在所选城市或州的人员

<?php
$servername = "localhost";
$username = "root";
$password = "usbw";
$dbname = "persons";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT person_id, person_firstname, person_lastname, 
           person_email, person_phonenumber,  
           address_street,address_housenumber, 
           address_city,address_state,address_zipcode, cv_path
    FROM person 
       inner join address on address.address_id = person.person_address 
       inner join cv on cv.cv_id = person.person_cv";

$result = $conn->query($sql);
if ($result->num_rows > 0) {

  echo "<table border=1>
  <tr>
  <th>Voornaam</th>
  <th>Achternaam</th>
  <th>Straat</th>
  <th>Huisnummer</th>
  <th>Postcode</th>
  <th>Stad</th>
  <th>Provincie</th>
  <th>Email</th>
  <th>Mobiel</th>
  <th>cv</th>
  <th>delete</th>
  </tr>";


while($row = $result->fetch_assoc()) {
    echo "<form action=delete.php method=post>";
    echo "<tr>";
    echo "<td>" . $row["person_firstname"] . "</td>";
    echo "<td>" . $row["person_lastname"] . "</td>";
    echo "<td>" . $row["address_street"] . "</td>";
    echo "<td>" . $row["address_housenumber"] . "</td>";
    echo "<td>" . $row["address_zipcode"] . "</td>";
    echo "<td>" . $row["address_city"] . "</td>";
    echo "<td>" . $row["address_state"] . "</td>";
    echo "<td>" . $row["person_email"] . "</td>";
    echo "<td>" . $row["person_phonenumber"] . "</td>";
    echo "<td><a href='http://localhost:8080/website/" . $row['cv_path'] . "'>cv file</a></td>";
    echo "<td>" . "<input type=submit name=delete value=delete>" . " </td>";
    echo "</tr>";
    echo "</form>";
}
}
else {
echo "Er is niks in het database gevonden";
}

$conn->close();
?>


上面的代码是显示数据库中的数据并将其放入表中的代码。现在,当我选择(示例)鹿特丹时,表中应该只显示Rohied。选择provincie时也是如此。。。在我的数据库中,stad是address_city,provincie是address_state。我可能错了,但是有没有办法让荷兰所有的城市都出现在下拉菜单中。。。因此,当选择鹿特丹时,它将显示Rohied,但当选择其他随机城市时,它将显示数据库中没有人居住在所选城市(或州)

“我想知道这是否可能……”任何事情都是可能的。你有什么特别的问题吗?我在网上试了很多代码,但都没用。我真的不知道从哪里开始。我是新来PHP的,所以我希望我能从这里得到帮助,帮助我添加两个下拉菜单,可以/将做上述请阅读,因此不是一个免费的编码或教程服务,你必须表明你已经做了一些努力来解决你自己的问题。我看到等待我上传我的代码使用下拉菜单。你必须把信息从您希望过滤到查询的“Where”语句中的内容,如“Where address\u city like“{$filter\u city}%”