且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL查询返回错误结果

更新时间:2022-11-27 12:49:01

您在PHP代码中的查询不会产生所需的结果,因为您已将PositionSecondary设置为相同的值.根据您提供的示例数据,该数据将不会返回任何内容.

Your query in the PHP code won't produce the desired result because you have it setting Position and Secondary to the same value. Based on the sample data you provided that won't return anything.

如果您正在寻找一个查询来选择符合条件的玩家,那么您可以将查询更改为以下形式:

If you're looking for a query to select eligible players for the dropdwon you could change the query to look like this:

SELECT * FROM `allsquads` 
WHERE `Team` = '$t1select'  
AND (`Position` = '$position[$i]' OR `Secondary` = '$position[$i]')