Fatal Error in Gdn_Database.Query();

Unknown column 'iu.PhotoID' in 'on clause'

select d.InsertUserID as `FirstUserID`, d.DateInserted as `FirstDate`, iu.Name as `FirstName`, iup.Name as `FirstPhoto`, d.Body as `Body`, d.Format as `Format`, d.DateLastComment as `LastDate`, d.LastCommentUserID as `LastUserID`, lcu.Name as `LastName`, concat_ws(' → ', pc.Name, ca.Name) as `Category`, ca.UrlCode as `CategoryUrlCode`, d.*, w.UserID as `WatchUserID`, w.DateLastViewed as `DateLastViewed`, w.Dismissed as `Dismissed`, w.Bookmarked as `Bookmarked`, w.CountComments as `CountCommentWatch` from GDN_Discussion d left join GDN_User iu on d.InsertUserID = iu.UserID left join GDN_Photo iup on iu.PhotoID = iup.PhotoID left join GDN_User lcu on d.LastCommentUserID = lcu.UserID left join GDN_Category ca on d.CategoryID = ca.CategoryID left join GDN_Category pc on ca.ParentCategoryID = pc.CategoryID left join GDN_UserDiscussion w on d.DiscussionID = w.DiscussionID and w.UserID = 0 where d.CategoryID in (:dCategoryID, :dCategoryID0, :dCategoryID1, :dCategoryID2, :dCategoryID3) and d.Announce = :dAnnounce and (w.Dismissed is null or w.Dismissed = :wDismissed) order by d.DateLastComment desc limit 10

The error occurred on or near: /homez.478/dardos/www/foro/library/database/class.database.php

227: 
228:          if (!is_object($PDOStatement)) {
229:             trigger_error(ErrorMessage('PDO Statement failed to prepare', $this->ClassName, 'Query', $this->GetPDOErrorMessage($this->Connection()->errorInfo())), E_USER_ERROR);
230:          } else if ($PDOStatement->execute($InputParameters) === FALSE) {
231:             trigger_error(ErrorMessage($this->GetPDOErrorMessage($PDOStatement->errorInfo()), $this->ClassName, 'Query', $Sql), E_USER_ERROR);
232:          }
233:       } else {
234:          $PDOStatement = $this->Connection()->query($Sql);
235:       }

Backtrace:

/homez.478/dardos/www/foro/library/database/class.database.phpPHP::Gdn_ErrorHandler();
[/homez.478/dardos/www/foro/library/database/class.database.php:231] PHP::trigger_error();
[/homez.478/dardos/www/foro/library/database/class.sqldriver.php:1553] Gdn_Database->Query();
[/homez.478/dardos/www/foro/library/database/class.sqldriver.php:632] Gdn_SQLDriver->Query();
[/homez.478/dardos/www/foro/applications/vanilla/models/class.discussionmodel.php:169] Gdn_SQLDriver->Get();
[/homez.478/dardos/www/foro/applications/vanilla/controllers/class.discussionscontroller.php:52] DiscussionModel->GetAnnouncements();
[/homez.478/dardos/www/foro/library/core/class.dispatcher.php:265] DiscussionsController->Index();
[/homez.478/dardos/www/foro/index.php:40] Gdn_Dispatcher->Dispatch();

Variables in local scope:

[Sql] 'select d.InsertUserID as `FirstUserID`, d.DateInserted as `FirstDate`, iu.Name as `FirstName`, iup.Name as `FirstPhoto`, d.Body as `Body`, d.Format as `Format`, d.DateLastComment as `LastDate`, d.LastCommentUserID as `LastUserID`, lcu.Name as `LastName`, concat_ws(\' → \', pc.Name, ca.Name) as `Category`, ca.UrlCode as `CategoryUrlCode`, d.*, w.UserID as `WatchUserID`, w.DateLastViewed as `DateLastViewed`, w.Dismissed as `Dismissed`, w.Bookmarked as `Bookmarked`, w.CountComments as `CountCommentWatch`
from GDN_Discussion d
left join GDN_User iu on d.InsertUserID = iu.UserID
left join GDN_Photo iup on iu.PhotoID = iup.PhotoID
left join GDN_User lcu on d.LastCommentUserID = lcu.UserID
left join GDN_Category ca on d.CategoryID = ca.CategoryID
left join GDN_Category pc on ca.ParentCategoryID = pc.CategoryID
left join GDN_UserDiscussion w on d.DiscussionID = w.DiscussionID and w.UserID = 0
where d.CategoryID in (:dCategoryID, :dCategoryID0, :dCategoryID1, :dCategoryID2, :dCategoryID3)
 and d.Announce = :dAnnounce
  and (w.Dismissed is null
  or w.Dismissed = :wDismissed)
order by d.DateLastComment desc
limit 10'
[InputParameters] array (
  ':dCategoryID' => '1',
  ':dCategoryID0' => '2',
  ':dCategoryID1' => '3',
  ':dCategoryID2' => '4',
  ':dCategoryID3' => '-1',
  ':dAnnounce' => '1',
  ':wDismissed' => '0',
)
[Event] ''
[PDOStatement] array (
  'queryString' => 'select d.InsertUserID as `FirstUserID`, d.DateInserted as `FirstDate`, iu.Name as `FirstName`, iup.Name as `FirstPhoto`, d.Body as `Body`, d.Format as `Format`, d.DateLastComment as `LastDate`, d.LastCommentUserID as `LastUserID`, lcu.Name as `LastName`, concat_ws(\' → \', pc.Name, ca.Name) as `Category`, ca.UrlCode as `CategoryUrlCode`, d.*, w.UserID as `WatchUserID`, w.DateLastViewed as `DateLastViewed`, w.Dismissed as `Dismissed`, w.Bookmarked as `Bookmarked`, w.CountComments as `CountCommentWatch`
from GDN_Discussion d
left join GDN_User iu on d.InsertUserID = iu.UserID
left join GDN_Photo iup on iu.PhotoID = iup.PhotoID
left join GDN_User lcu on d.LastCommentUserID = lcu.UserID
left join GDN_Category ca on d.CategoryID = ca.CategoryID
left join GDN_Category pc on ca.ParentCategoryID = pc.CategoryID
left join GDN_UserDiscussion w on d.DiscussionID = w.DiscussionID and w.UserID = 0
where d.CategoryID in (:dCategoryID, :dCategoryID0, :dCategoryID1, :dCategoryID2, :dCategoryID3)
 and d.Announce = :dAnnounce
  and (w.Dismissed is null
  or w.Dismissed = :wDismissed)
order by d.DateLastComment desc
limit 10',
)

Need Help?

If you are a user of this website, you can report this message to a website administrator.

If you are an administrator of this website, you can get help at the Vanilla Community Forums.

Additional information for support personnel: