从mysqli_fetch_array获取错误

时间:2016-10-16 13:08:38

标签: mysql sql

我的查询热线是:

SELECT TR.*, 
       PL.*, DE.*, 
       ( DE.power + DE.stamina + DE.violence + DE.speed + DE.shooting + DE.scoring + DE.pass + DE.ball_control + DE.talent ) AS TPOWER,
       strftime('%Y-%d-%m', DE.age, 'unixepoch') AS age 
       FROM `transfers` TR JOIN `players` PL ON TR.player_id=PL.id 
       JOIN `playerdetails` DE ON TR.player_id=DE.player_id
       WHERE PL.position = 'MD' AND ( age >= '20' AND age <= '24' ) 
       AND PL.firstname = 'a' AND PL.lastname = 'b' AND TPOWER >= '1' 
       AND TPOWER <= '5' AND TR.price >= '20' AND TR.price <= '50'
       ORDER BY age DESC

此查询有什么问题?

发生错误:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in E:\EasyPHP-Devserver-16.1\eds-www\classes\DB.php on line 15

1 个答案:

答案 0 :(得分:0)

MySQL没有名为strftime()的功能。您可能需要date_format()代替:

SELECT . . .
       date_format(de.age, '%Y-%d-%m') AS age 

然而,这似乎是一种表达年龄的奇怪方式(通常是整数,数字或间隔)。

您的查询也可能有其他错误。您应该检查返回的错误消息。