Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Fatal Error in Unknown column 'd.DiscussionID' in 'on clause'

camocamo New
edited October 2011 in Vanilla 2.0 - 2.8
Getting This error when clicking Tags links in 'popular tags'. Dont know what it means or how to fix it, please help?

Fatal Error in Gdn_Database.Query();

Unknown column 'd.DiscussionID' in 'on clause'
select c.*, lc.DateInserted as `DateLastComment`
from GDN_Category c
join GDN_TagDiscussion td on d.DiscussionID = td.DiscussionID
left join GDN_Comment lc on c.LastCommentID = lc.CommentID
where td.TagID in ('6')
order by c.TreeLeft asc
limit 15
The error occurred on or near: /forum/library/database/class.database.php
283: $PDOStatement = $this->Connection()->query($Sql);
284: }
285:
286: if ($PDOStatement === FALSE) {
287: trigger_error(ErrorMessage($this->GetPDOErrorMessage($this->Connection()->errorInfo()), $this->ClassName, 'Query', $Sql), E_USER_ERROR);
288: }
289:
290: // Did this query modify data in any way?
291: if ($ReturnType == 'ID') {


Variables in local scope:
[Sql] 'select c.*, lc.DateInserted as `DateLastComment`
from GDN_Category c
join GDN_TagDiscussion td on d.DiscussionID = td.DiscussionID
left join GDN_Comment lc on c.LastCommentID = lc.CommentID
where td.TagID in (\'6\')
order by c.TreeLeft asc
limit 15'
[InputParameters] array (
)
[Options] array (
'ReturnType' => 'DataSet',
)
[ReturnType] 'DataSet'
[PDOStatement] false

************************************

ALSO THIS ERROR ON Click delete from 'options' in discussions veiw....


Unknown column 't.Type' in 'where clause'
select t.*
from GDN_TagDiscussion td
join GDN_Tag t on td.TagID = t.TagID
where td.DiscussionID = :tdDiscussionID
and t.Type = :tType
The error occurred on or near: /s101-2/home6/camosreptiles/forum/library/database/class.database.php
276:
277: if (!is_object($PDOStatement)) {
278: trigger_error(ErrorMessage('PDO Statement failed to prepare', $this->ClassName, 'Query', $this->GetPDOErrorMessage($this->Connection()->errorInfo())), E_USER_ERROR);
279: } else if ($PDOStatement->execute($InputParameters) === FALSE) {
280: trigger_error(ErrorMessage($this->GetPDOErrorMessage($PDOStatement->errorInfo()), $this->ClassName, 'Query', $Sql), E_USER_ERROR);
281: }
282: } else {
283: $PDOStatement = $this->Connection()->query($Sql);
284: }


Variables in local scope:
[Sql] 'select t.*
from GDN_TagDiscussion td
join GDN_Tag t on td.TagID = t.TagID
where td.DiscussionID = :tdDiscussionID
and t.Type = :tType'
[InputParameters] array (
':tdDiscussionID' => '31',
':tType' => '',
)
[Options] array (
'ReturnType' => 'DataSet',
)
[ReturnType] 'DataSet'
[PDOStatement] array (
'queryString' => 'select t.*
from GDN_TagDiscussion td
join GDN_Tag t on td.TagID = t.TagID
where td.DiscussionID = :tdDiscussionID
and t.Type = :tType',
)

Best Answer

  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    This issue has been fixed for 2.0.18 rc3.

Answers

  • UnderDogUnderDog MVP
    edited October 2011
    some reading material to get started with:
    http://vanillaforums.org/discussion/17228/unknown-column-when-clicking-tag/p1
    Prepare as much information as you can for a bug report on gitHub. We need to figure out whether the programmers want a bug report on gitHub or here on the forum, since it's related to the Tagging plugin, but also related to Discussions.

    There was an error rendering this rich post.

  • LincLinc Detroit Admin
    Have you run /utility/update?

  • @Lincoln
    ran utility update + success, but still getting exact same error when clicking tags links in 'popular tags'.

    @UnderDog Im pretty sure the second issue is due to the first, and that the first is because Ive messed my DB rather than a code bug.
  • camocamo New
    edited October 2011
    I swear I didnt do that Guys! ???? I only saved once!
  • UnderDogUnderDog MVP
    edited October 2011
    @camo don't worry, we'll fix the multiposts :-)
    The issue you see is because the table with discussions isn't in the query. If you look in the other thread you will see the query I'm talking about.
    This issue only comes up if you have the view set to a certain setting (for example "Categories only" or "Categories and Discussions" and then try to access one single tag. In your case where td.TagID in ('6')

    The second issue Unknown column 't.Type' in 'where clause' is because the field "type" isn't present in the TagDiscussion table.
    There are many many ways to resolve that problem.

    I do have the feeling that the RC version of Vanilla will be announced soon. If you do a clean install on a separate location (maybe your local PC) that's the quickest way to resolve that problem.
    Fixed the double save for you :-)

    There was an error rendering this rich post.

  • camocamo New
    edited October 2011
    @UnderDog

    Ok I installed XAMPP 1.7.7.win 32 and successfully installed there, but the problem remains on my original database. Did you mean just start again on my local host? Or something you forgot to tell me? I dont want to start again, I have a great server host and people know where we are already. Is there another fix for the error above?

    http://localhost/vanilla/index.php?p=/

    Can I export the Tag related tables from the localhost installation then import to my original database?

  • @UnderDog
    Upgraded to 2.0.18 RC2 but problem remains, please comment on last question re export/import of tag tables?
  • UnderDogUnderDog MVP
    edited October 2011
    Try this:
    Export the structure of the messed up tag table
    Export the structure of the tag table of RC2
    Compare those structures, there should be a difference.
    Hopefully it's only the "type" field that's missing from the messed up tag table
    in that case, add that single field.
    Does the messed up tag table have any entries?

    Just for fun, you can try and copy the messed up Vanilla install from your host to your localhost. You can for example put it in the directory "vanilla_mess" and the table could be "vanilla_mess"
    You have to make some changes in the config file of "vanilla_mess" once you've copied it from your webhost to your localhost and you have to change the config table.

    Search on the forums, there's some posts about this in the forum and in the documentation.

    Now you have a messed up install on your localhost, you can try to fix your messed up install locally and then you know what you need to do on your server to fix the problem there.

    There was an error rendering this rich post.

  • camocamo New
    edited October 2011
    Whoa! slow down, my localhost install is fine. I upgraded my original webhost install to RC2

    So I need to export the tag table structure from my local host install, then export the messed up tag table structure from my RC2 install and compare, yes?

    Then add the missing feild from the localhost install to the database in my original install ?

    Yes, the original install has 4 tags, should I delete those first?

    OK heres the local host tables for Tag (no tag entries)
    -- phpMyAdmin SQL Dump
    -- version 3.4.5
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Oct 08, 2011 at 01:42 PM
    -- Server version: 5.5.16
    -- PHP Version: 5.3.8

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";


    /*!40101 SET @CHARACTER_SET_CLIENT */;
    /*!40101 SET @CHARACTER_SET_RESULTS */;
    /*!40101 SET @COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;

    --
    -- Database: `vanilla`
    --

    -- --------------------------------------------------------

    --
    -- Table structure for table `gdn_tag`
    --

    CREATE TABLE IF NOT EXISTS `gdn_tag` (
    `TagID` int(11) NOT NULL AUTO_INCREMENT,
    `Name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `Type` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
    `InsertUserID` int(11) DEFAULT NULL,
    `DateInserted` datetime NOT NULL,
    `CountDiscussions` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`TagID`),
    UNIQUE KEY `UX_Tag` (`Name`),
    KEY `IX_Tag_Type` (`Type`),
    KEY `FK_Tag_InsertUserID` (`InsertUserID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

    -- --------------------------------------------------------

    --
    -- Table structure for table `gdn_tagdiscussion`
    --

    CREATE TABLE IF NOT EXISTS `gdn_tagdiscussion` (
    `TagID` int(11) NOT NULL,
    `DiscussionID` int(11) NOT NULL,
    PRIMARY KEY (`TagID`,`DiscussionID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    Heres the original (messed up/4 tag entries)
    -- phpMyAdmin SQL Dump
    -- version 2.11.9.2
    -- http://www.phpmyadmin.net
    --
    -- Host: nfsc-2.server101.com
    -- Generation Time: Oct 08, 2011 at 10:48 PM
    -- Server version: 5.1.35
    -- PHP Version: 5.2.12

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

    --
    -- Database: `db_camo_forum`
    --

    -- --------------------------------------------------------

    --
    -- Table structure for table `GDN_Tag`
    --

    CREATE TABLE IF NOT EXISTS `GDN_Tag` (
    `TagID` int(11) NOT NULL AUTO_INCREMENT,
    `Name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `Type` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
    `InsertUserID` int(11) DEFAULT NULL,
    `DateInserted` datetime NOT NULL,
    `CountDiscussions` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`TagID`),
    UNIQUE KEY `UX_Tag` (`Name`),
    KEY `FK_Tag_InsertUserID` (`InsertUserID`),
    KEY `IX_Tag_Type` (`Type`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=10 ;

    --
    -- Dumping data for table `GDN_Tag`
    --

    INSERT INTO `GDN_Tag` (`TagID`, `Name`, `Type`, `InsertUserID`, `DateInserted`, `CountDiscussions`) VALUES
    (6, 'lacemonitor', NULL, 13, '2011-10-07 23:49:20', 1),
    (7, 'news', NULL, 13, '2011-10-07 23:49:20', 1),
    (8, 'wildlife', NULL, 13, '2011-10-07 23:49:20', 1),
    (9, 'tasmania', NULL, 13, '2011-10-07 23:49:20', 1);

    -- --------------------------------------------------------

    --
    -- Table structure for table `GDN_TagDiscussion`
    --

    CREATE TABLE IF NOT EXISTS `GDN_TagDiscussion` (
    `TagID` int(11) NOT NULL,
    `DiscussionID` int(11) NOT NULL,
    PRIMARY KEY (`TagID`,`DiscussionID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

    --
    -- Dumping data for table `GDN_TagDiscussion`
    --

    INSERT INTO `GDN_TagDiscussion` (`TagID`, `DiscussionID`) VALUES
    (6, 31),
    (7, 31),
    (8, 31),
    (9, 31);

  • ToddTodd Chief Product Officer Vanilla Staff
    Try /utility/update
  • @Todd
    done but no change....
  • I have this problem too.
    /utility/update don't help

    The problem appears only when I'm in guest roles on the site. When I admin - tags are working correctly.
  • Having this issue again despite fresh install of both vanilla and the plugin. The tagging was working fine before.
    Im now getting the exact same error I opened this topic with.

    Might the following work?

    1. disable taggle
    2. remove tagging
    3. empty all tag related database tables
    4 reupload tagging plugin
    5. re-enable
    6. utility update

    ?
  • Report sent to github.
  • ToddTodd Chief Product Officer Vanilla Staff
    Answer ✓
    This issue has been fixed for 2.0.18 rc3.
Sign In or Register to comment.