在sql php中将多个属性排序为一个

在sql php中将多个属性排序为一个,php,html,sql,forms,Php,Html,Sql,Forms,我想知道sql查询将如何获得select,具体取决于表ATIBUTE NumberRecords,但有许多行具有相同的数字,如1,2,因此我只想知道哪些是1和2 这是我的代码,很多代码都出来了 $con = mysqli_connect('localhost','root','','customer_service_experts'); if (!$con) { die('Could not connect: ' . m

我想知道sql查询将如何获得select,具体取决于表ATIBUTE NumberRecords,但有许多行具有相同的数字,如1,2,因此我只想知道哪些是1和2

这是我的代码,很多代码都出来了

$con = mysqli_connect('localhost','root','','customer_service_experts');
                  if (!$con) {
                    die('Could not connect: ' . mysqli_error($con));
                  }

                  $sql = "SELECT * FROM `employee_product` where NumberRecords =2";

                  $result = mysqli_query($con,$sql);

                    while($row = mysqli_fetch_array($result)){

                          $NumberRecords = $row["NumberRecords "];


                          echo "<option  value='".$NumberRecords ."'>".$NumberRecords ."</option> ";
                      }
$con=mysqli\u connect('localhost'、'root'、''、'customer\u service\u experts');
如果(!$con){
die('无法连接:'。mysqli_错误($con));
}
$sql=“从'employee\u product'中选择*,其中NumberRecords=2”;
$result=mysqli\u查询($con,$sql);
while($row=mysqli\u fetch\u数组($result)){
$NumberRecords=$row[“NumberRecords”];
回显“$NumberRecords.”;
}
这是我希望从此表中选择的内容


数字记录1
数字记录2

这行有一个额外的空格:

 $NumberRecords = $row["NumberRecords "];
将其更改为:

 $NumberRecords = $row["NumberRecords"];
但是,如果希望只得到一行,则需要使用
分组依据

SELECT * FROM `employee_product` WHERE NumberRecords =2 GROUP BY NumberRecords

你能澄清一下吗?我不知道你需要什么。我刚刚更新了表或picok,你已经尝试过什么SQL查询了吗?还有,这是
表单中的
选择
?你需要展示整个表单。很明显,它不是全部。表单属性和处理请求的PHP在哪里?它是邮寄/邮寄的吗?请展示你所尝试过的一切。这样我就可以自己获得号码了?你需要尝试一下,并让我知道它是否适合你。是的,非常感谢你花时间帮助我解决问题。我很高兴你试过了。