Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MySQL查询没有显示任何结果,直到我复制并粘贴,它才得到1_Php_Mysql_Wordpress_Wpml - Fatal编程技术网

Php MySQL查询没有显示任何结果,直到我复制并粘贴,它才得到1

Php MySQL查询没有显示任何结果,直到我复制并粘贴,它才得到1,php,mysql,wordpress,wpml,Php,Mysql,Wordpress,Wpml,将WordPress与WordPress多语言一起使用。我注意到一个页面是404,所以我转储了正在输出的查询,得到了以下内容(格式与下面完全相同): SELECT newsite\u posts.*从newsite\u posts加入newsite\u icl\u翻译newsite\u posts.ID=t.element\u ID 和t.element_type='post_sections'在t.language_code=l.code和l.active=1上加入newsite_icl_la

将WordPress与WordPress多语言一起使用。我注意到一个页面是404,所以我转储了正在输出的查询,得到了以下内容(格式与下面完全相同):

SELECT newsite\u posts.*从newsite\u posts加入newsite\u icl\u翻译newsite\u posts.ID=t.element\u ID
和t.element_type='post_sections'在t.language_code=l.code和l.active=1上加入newsite_icl_languages l,其中1=1,newsite_posts.post_name='advisory practice'和newsite_posts.ID=456,newsite_posts.posts_type='sections'和t.language_code='es'按newsite_posts.posts排序。posts_日期描述
将其放入PHPMyAdmin SQL选项卡,得到0个结果。在“MySQL返回一个空结果集”的部分下面,它为我重新输出了我的查询,格式如下:

SELECT newsite\u posts.*
来自newsite_的帖子
在newsite\u posts.ID=t.element\u ID上加入newsite\u icl\u翻译
和t.element_type='post_扇区'
在t.language\u code=l.code上加入newsite\u icl\u语言
l.active=1
其中1=1
和newsite_posts.post_name=‘咨询实践’
和newsite_posts.ID=456
和newsite_posts.post_type='sectors'
和t.language_code='es'
按newsite\u posts.post\u date DESC订购

因此,我复制并粘贴回phpmyadmin的SQL选项卡,它可以工作,找到了1行。这是相同的查询,格式不同。这是怎么回事?这也影响了我的代码,它不仅仅是一个phpmyadmin错误。我疯了吗?我遗漏了什么吗?

将PHPMYADMIN SQL复制并粘贴回原始PHP代码(仅用于测试)时会发生什么?那它能正常工作吗?我也有过同样的问题。尝试将
JOIN
更改为不包含
将t.language_code=l.code上的
分开,并将
和l.active=1
放在WHERE condition中。您的服务器和数据库是否使用相同的字符编码?上次我有类似的事情发生,是因为字符编码不同,所以即使它看起来像相同的内容,实际上却不是。