Loading...
 
Skip to main content

Image Galleries - Sort by Images Raises Query Error

Status
Closed
Subject
Image Galleries - Sort by Images Raises Query Error
Version
2.x
Category
  • Error
Feature
Image Gallery
Submitted by
hmayer1980
Lastmod by
pkdille
Rating
(0)
Description

If you show a list of image galleries and want to sort by images count you get an SQL query error.

Tiki outputs the following SQL Query

select g.`galleryId`,g.`name`,g.`description`, g.`created`,g.`lastModif`,g.`visible`,g.`theme`,g.`user`, g.`hits`,g.`maxRows`,g.`rowImages`,g.`thumbSizeX`, g.`thumbSizeY`,g.`public`,g.`sortorder`,g.`sortdirection`, g.`galleryimage`,g.`parentgallery`,count(i.`imageId`) as numimages from `tiki_galleries` g, `tiki_images` i where i.`galleryId`=g.`galleryId` and `parentgallery`=? group by g.`galleryId`, g.`name`,g.`description`, g.`created`,g.`lastModif`,g.`visible`,g.`theme`,g.`user`, g.`hits`,g.`maxRows`,g.`rowImages`,g.`thumbSizeX`, g.`thumbSizeY`,g.`public`,g.`sortorder`,g.`sortdirection`, g.`galleryimage`,g.`parentgallery` order by `images` desc


As you can see - the order by references an invalid column - because in the select list the field is named "numimages" and the order by uses "images".

Solution

Thanks for this ticket and for all the information included (the sql query and the origine of the problem).

It is now fixed in trunk code (which is in fact the tiki 3.0 code).

Should maybe be backported to 2.0 and released with 2.1 version.
I keep this ticket opened as the problem is not already fixed in 2.0 version.

Fixed also ported to 2.0. Ticket closed.

Importance
5
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
1962
Created
Saturday 16 August, 2008 16:33:30 UTC
by Unknown
LastModif
Friday 19 September, 2008 07:57:56 UTC


Show PHP error messages