PHP查询可在localhost中运行,但会在实时服务器上中断

问题描述

正如标题所示,我有一个在localhost上运行良好的查询,但是在我的实时环境中,出现500服务器错误。我的本地PHP版本是7.4,但实时服务器使用7.3。

我得到的错误

PHP Fatal error:  Uncaught PDOException: sqlSTATE[42000]: Syntax error or access violation: 
1064 You have an error in your sql Syntax; check the manual that corresponds to your MysqL 
server version for the right Syntax to use near '(partition by prop_slug order by 
  prop_client) as rn 
  FROM listing_details 
  JOI' at line 4 in /hermes/bosnaweb23a/b60/ipg.site/site/index.PHP:23 
Stack trace: 
#0 /hermes/bosnaweb23a/b60/ipg.site/site/index.PHP(23): PDOStatement->execute() 
#1 {m 

我的查询如下所示,但是正如我所说的,它在本地环境中可以正常工作。

 $get_listings = $db->prepare('SELECT *
 FROM (
 SELECT *,row_number() over(partition by prop_slug order by prop_client) as rn
 FROM listing_details
 JOIN prop_gallery
 ON prop_gallery.prop_gallery_id = listing_details.prop_slug 
 WHERE prop_slug LIKE prop_gallery_id OR prop_gallery_id LIKE prop_slug
 AND listing_details.prop_mandate = 1
 ) x
 where rn = 1');
 $get_listings->execute();
 $listings = $get_listings->fetchAll();

 if (!$listings) { 
  echo 'Error: No Listings.';
 }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)