[web API] Can't give an order to pwg.tags.getImages #317

Closed
opened 2026-10-04 23:51:53 +02:00 by adam · 3 comments
Owner

Reported by Epy on 15 Mar 2015 15:26

Version: 2.7.4

Hi,
I was playing with webservices with a python script and web UI here: http://piwigo.org/demo/tools/ws.htm#top
when I got this error:

If I send any authorized value (from the info popup) in the "order" field I get a MySQL error

Warning: [mysql error 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 'RAND()' at line 8

SELECT id
FROM images i
INNER JOIN image_category ic ON id=ic.image_id
INNER JOIN image_tag it ON id=it.image_id
WHERE tag_id IN (72)
AND (category_id NOT IN (9,10,11,12,13,18,28,65,66,67,48,50,71) AND level<=0)
GROUP BY id
RAND() in /home/sys/var/www/piwigo.org/demo/include/dblayer/functions_mysqli.inc.php on line 830

Fatal error: Call to a member function fetch_assoc() on a non-object in /home/sys/var/www/piwigo.org/demo/include/dblayer/functions_mysqli.inc.php on line 891

Steps to reproduce: Go to: http://piwigo.org/demo/tools/ws.htm

Choose pwg.tags.getImages on the left

Enter a tag id (e.g. 72 'Weather')

Enter an order for sorting from the info button, for example 'random' or 'date_creation'

Select "Invoke", you'll get the error in result frame

Additional information: I don't have a gallery right now, so I just played with the demo one and didn't try another

That's why I don't have any information on webserver software versions or piwigo version

Piwigo Bugtracker #3211

**Reported by Epy on 15 Mar 2015 15:26** **Version:** 2.7.4 Hi, I was playing with webservices with a python script and web UI here: http://piwigo.org/demo/tools/ws.htm#top when I got this error: If I send any authorized value (from the info popup) in the &quot;order&quot; field I get a MySQL error Warning: [mysql error 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 &#039;RAND()&#039; at line 8 SELECT id FROM images i INNER JOIN image_category ic ON id=ic.image_id INNER JOIN image_tag it ON id=it.image_id WHERE tag_id IN (72) AND (category_id NOT IN (9,10,11,12,13,18,28,65,66,67,48,50,71) AND level&lt;=0) GROUP BY id RAND() in /home/sys/var/www/piwigo.org/demo/include/dblayer/functions_mysqli.inc.php on line 830 Fatal error: Call to a member function fetch_assoc() on a non-object in /home/sys/var/www/piwigo.org/demo/include/dblayer/functions_mysqli.inc.php on line 891 **Steps to reproduce:** Go to: http://piwigo.org/demo/tools/ws.htm Choose pwg.tags.getImages on the left Enter a tag id (e.g. 72 &#039;Weather&#039;) Enter an order for sorting from the info button, for example &#039;random&#039; or &#039;date_creation&#039; Select &quot;Invoke&quot;, you&#039;ll get the error in result frame **Additional information:** I don&#039;t have a gallery right now, so I just played with the demo one and didn&#039;t try another That&#039;s why I don&#039;t have any information on webserver software versions or piwigo version [Piwigo Bugtracker #3211](http://piwigo.org/bugs/view.php?id=3211) <!-- github-sync-id:97252309 -->
adam closed this issue 2026-10-04 23:51:53 +02:00
Author
Owner

Comment posted by Epy on 16 Mar 2015 09:53

(Sorry, I didn't see the first bug report when I searched)

**Comment posted by Epy on 16 Mar 2015 09:53** (Sorry, I didn&#039;t see the first bug report when I searched) <!-- github-comment-id:124899237 -->
Author
Owner
Hi, i confirm this bug.This request : http://XXXXXX.piwigo.com/ws.php?tag_id=&per_page=3&page=0&tag_name=Homepage&order=random&method=pwg.tags.getImages&format=php return nothing :( <!-- github-comment-id:175528643 -->
Author
Owner

Corrected more than a year ago in commit 2b58912b96

Corrected more than a year ago in commit 2b58912b96e74e36d3bc2cd5d57d3e5c36c461f3 <!-- github-comment-id:175551897 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#317