MySQL query shows no results, until I copy and paste, then it gets 1

Using WordPress with WordPress MultiLanguage. I noticed a page was 404ing, so I dumped the query that was being output, and got the following (formatted exactly like below):

SELECT   newsite_posts.* FROM newsite_posts   JOIN newsite_icl_translations t ON newsite_posts.ID = t.element_id
                    AND t.element_type = 'post_sectors' JOIN newsite_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1  AND newsite_posts.post_name = 'advisory-practice' AND newsite_posts.ID = 456 AND newsite_posts.post_type = 'sectors' AND t.language_code='es'  ORDER BY newsite_posts.post_date DESC 

Threw it in PHPMyAdmin SQL tab, got 0 results. Beneath the part where it says “MySQL returned an empty result set”, it reoutputted my query for me, formatted like below:

Read More
SELECT newsite_posts. * 
FROM newsite_posts
JOIN newsite_icl_translations t ON newsite_posts.ID = t.element_id
AND t.element_type =  'post_sectors'
JOIN newsite_icl_languages l ON t.language_code = l.code
AND l.active =1
WHERE 1 =1
AND newsite_posts.post_name =  'advisory-practice'
AND newsite_posts.ID =456
AND newsite_posts.post_type =  'sectors'
AND t.language_code =  'es'
ORDER BY newsite_posts.post_date DESC 

so I copied and pasted back into the SQL tab of phpmyadmin and it works, 1 row found. This is the same exact query, formatted differently. What is going on here? This is affecting my code, too, it’s not just a phpmyadmin bug. Am I crazy? Am I missing something?

Related posts

Leave a Reply