Gallery entry tag can mysql error w/bad sort param…. |
|||
|---|---|---|---|
| Date: | 07/15/2008 | Severity: | Trivial |
| Status: | Resolved | Reporter: | Robin Sowell |
| Version: | EE 1.6.4 | Assigned To: | Not Assigned |
| Keywords: | MySQL Errors | ||
Details
re: http://expressionengine.com/forums/viewthread/85196/
Basically- was getting a
MySQL ERROR:
Error Number: 1064
Description: 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 'title, e.entry_id title' at line 5
Query: SELECT e.entry_id FROM exp_gallery_entries AS e LEFT JOIN exp_galleries AS p ON p.gallery_id = e.gallery_id LEFT JOIN exp_gallery_categories AS c ON c.cat_id = e.cat_id LEFT JOIN exp_members AS m ON e.author_id = m.member_id WHERE e.gallery_id = '1' AND e.status = 'o' AND e.entry_date < 1216088693 AND e.cat_id = '3' ORDER BY e.entry_date title, e.entry_id title
I replicate on 1.6.4. Took me forever to spot what was up- he was using title as his sort- should be asc/desc.
Figure- code should catch that, and looks like it was meant to:
$sort = $TMPL->fetch_param('sort');
if ($sort == FALSE AND $sort != 'asc' AND $sort != 'desc')
{
$sort = 'desc';
}
Not sure why the false check- but anyway- that’s where title was coming from. I searched all over the place trying to figure out how that query got goobered!
