Jump to content

Forums table join


Recommended Posts

I've been using constructLoadQuery to add table joins for member and group data without any problems but this won't work with the forums database. I assume due to the node permissions.

Is there a work around for this or should I just use get_fieldname and cache my database queries? (I've got several fields in the table I want to join with forum data.)

    protected static function constructLoadQuery( $id, $idField, $extraWhereClause )
    {
        /* Get parent contruct query */
        $parentDB = parent::constructLoadQuery( $id, $idField, $extraWhereClause );

        /* Add our custom join */
        $parentDB->join( 'basicpoints_forums', 'basicpoints_forums.forum_id=forums_forums.id' );

        /* Return all */
        return $parentDB;
    }
Link to comment
Share on other sites

  • 1 month later...
  • Management

What is the MySQL error? It might just be a case of using arrays and parenthesis.

I've often been tripped up with the difference between:

$extraWhereClause = array( 'foo=?', $foo );

and:

$extraWhereClause = array( array( 'foo=?', $foo ) );

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...