query in block template after upgrade breaks site
Permalink
after updating from 5.5.2.1 to 5.6.2.1 this breaks. ideas???
$calIDs = $myDB->execute(" SELECT p.cID FROM Pages p JOIN CollectionVersions cv ON p.cID = cv.cID JOIN PageTypes pt ON p.ctID = pt.ctID WHERE pt.ctHandle = 'calendar_event' AND cIsTemplate = 0 AND cvDatePublic >= SYSDATE() AND cvIsApproved = 1 ORDER BY cvDatePublic LIMIT 1 "); $eID = $calIDs->fetchRow(); $eventPage = Page::getByID($eID); $pageLink = $eventPage->cPath;
remo, thank you for such a quick reply.
that does get the proper cID however i'm still getting an error:
mysqlt error: [1054: Unknown column 'Array' in 'where clause'] in EXECUTE("select Pages.cID, Pages.pkgID, Pages.cPointerID, Pages.cPointerExternalLink, Pages.cIsActive, Pages.cIsSystemPage, Pages.cPointerExternalLinkNewWindow, Pages.cFilename, Collections.cDateAdded, Pages.cDisplayOrder, Collections.cDateModified, cInheritPermissionsFromCID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cCheckedOutUID, cIsTemplate, uID, cPath, cParentID, cChildren, cCacheFullPageContent, cCacheFullPageContentOverrideLifetime, cCacheFullPageContentLifetimeCustom from Pages inner join Collections on Pages.cID = Collections.cID left join PagePaths on (Pages.cID = PagePaths.cID and PagePaths.ppIsCanonical = 1) where Pages.cID = Array")
that does get the proper cID however i'm still getting an error:
$eID = $calIDs->fetchRow(); $eventPage = Page::getByID($eID); $pageLink = $eventPage->cPath;
mysqlt error: [1054: Unknown column 'Array' in 'where clause'] in EXECUTE("select Pages.cID, Pages.pkgID, Pages.cPointerID, Pages.cPointerExternalLink, Pages.cIsActive, Pages.cIsSystemPage, Pages.cPointerExternalLinkNewWindow, Pages.cFilename, Collections.cDateAdded, Pages.cDisplayOrder, Collections.cDateModified, cInheritPermissionsFromCID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cCheckedOutUID, cIsTemplate, uID, cPath, cParentID, cChildren, cCacheFullPageContent, cCacheFullPageContentOverrideLifetime, cCacheFullPageContentLifetimeCustom from Pages inner join Collections on Pages.cID = Collections.cID left join PagePaths on (Pages.cID = PagePaths.cID and PagePaths.ppIsCanonical = 1) where Pages.cID = Array")
I can't tell you much since your code is incomplete. The theory: You're calling fetchRow which returns an array but Page::getByID expects a discrete value - a number..
Without knowing where $callIDs comes from, something like this could work:
Without knowing where $callIDs comes from, something like this could work:
$eID = $calIDs->fetchRow(); $eventPage = Page::getByID($eID['cID']); $pageLink = $eventPage->cPath;
you sir, are the man!
gracias
gracias
de nada!
Your query fails because the page (collection) type used to be part of "Pages" but has been moved to "CollectionVersions". That happened because the layout of a page is also something that should be versioned.
Long story short, use this: