Php 在搜索引擎中显示多个结果

Php 在搜索引擎中显示多个结果,php,mysql,search,Php,Mysql,Search,我在显示结果的搜索引擎中发现了一个bug。 代码如下: $nmanufacturer = $tApplication[2]; $manufac = mysql_query("SELECT * FROM tManufacturers WHERE nManufacturer='$nmanufacturer'"); $manufacts = mysql_fetch_array($manufac); //nom du constructeur $contruct = $manufacts[1];

我在显示结果的搜索引擎中发现了一个bug。 代码如下:

$nmanufacturer = $tApplication[2];

$manufac = mysql_query("SELECT * FROM tManufacturers WHERE nManufacturer='$nmanufacturer'");
$manufacts = mysql_fetch_array($manufac);

//nom du constructeur
$contruct = $manufacts[1];

?>

<select class="form-control">
<option><?php echo $contruct; ?></option>
</select>
$nmanumacturer=$tApplication[2];
$manufac=mysql_查询(“从tmanufacturer中选择*,其中nManufacturer='$nManufacturer'”);
$manufacts=mysql\u fetch\u数组($manufac);
//建造师姓名
$construct=$manufacts[1];
?>

问题是option元素只显示一个结果,但是数据库中有许多结果
希望你们能帮助我

祝你好运!你得做一会儿cicle

$nmanufacturer = $tApplication[2];

$manufac = mysql_query("SELECT * FROM tManufacturers WHERE Manufacturer='$nmanufacturer'");

?>

<select class="form-control">
<?php
while($manufact = mysql_fetch_array($manufac)) {
    echo '<option>' . $manufact[1] . '</option>';
}
?>
</select>
$nmanumacturer=$tApplication[2];
$manufac=mysql_查询(“从tManufacturers中选择*,其中Manufacturer='$nmanufacturer');
?>
mysql_fetch_array函数返回一个关联数组,但是如果没有更多的行要返回,它也会返回FALSE!使用PHP While循环,我们可以充分利用这些信息

如果我们将语句“$row=mysql\u fetch\u array()”作为while循环的条件语句,我们将完成两件事:

  • 我们将获得一行新的MySQL信息,可以打印出来 每次while循环检查其条件语句时
  • 当没有更多行时,函数将返回FALSE,从而导致 我要停下来
    via

    非常感谢这真的很有帮助,我会尝试一下谢谢你接受它作为最佳答案,如果你喜欢我的答案,我将非常高兴得到你的支持票。