I couldn't get the "Latest image"-block working though the "Random image"-block worked fine. Putting the word changed in the query string in line 587 in single quotation marks ('changed') helped.

This problem may have occured because of the relatively new software my hoster provides (PHP 5.1.2, MySQL 4.1.15).

Comments

Standart’s picture

Ok, this was too fast. Stupid, as my 'patch' seems to only deactivate the ORDER BY statement in some way in drupal. I played around with the SQL and found out that the following combinations work, respectively don't work:

work (more than 1 result):

SELECT * FROM node WHERE type='image' AND status=1;
SELECT * FROM node WHERE status=1 ORDER BY created DESC;
SELECT * FROM node WHERE status=1 AND 1=1 ORDER BY changed DESC;

don't work (0 results - no error):

SELECT * FROM node WHERE type='image' ORDER BY changed DESC;
SELECT * FROM node WHERE type='image' AND status=1 ORDER BY changed DESC;

So the combination of WHERE type='image' and ORDER BY seems to be the problem. This appears to me to be a very special MySQL problem. Maybe someone has an idea how to explain this behaviour.

benshell’s picture

Interesting... all five of your queries work and return more than one result on MySQL 4.1.18. Have you had a chance to try these queries on a different MySQL install? If you don't have access to another host, could you download and install MySQL on your workstation?

robo_arnold’s picture

I conducted the same tests on my local PC (Win XP Pro) running off MySQL 4.1.7 and observed exactly the same behavior as Standart. Weird.

Standart’s picture

Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev
Status: Active » Closed (won't fix)

So obviously this is not a drupal (or image) bug. I can't believe such a simple query is not working in MySQL 4.1 prior to 4.1.18. I moved my site to a server running MySQL 5 now and of course it's working fine.

qube’s picture

I can confirm this issue on MySQL 4.1.11 on Debian.

MySQL 5.0.24 is working without this problem.

(Drupal 4.7.3, newest image and img_assist)