Custom Fields
Support MB Relationships Trying to create a relationship ends in SQL Error

This topic contains 4 replies, has 3 voices, and was last updated by  Anh Tran 10 months ago.

  • Creator
  • #12572

    Vee Jay

    This is the error I get with debug mode on:

    WordPress database error: [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 'WHERE from=1 AND type='post2conf' ORDER BY order_from' at line 1]
    SELECT to FROM WHERE from=1 AND type='post2conf' ORDER BY order_from

    This is the code i’m trying to use:

    add_action( 'mb_relationships_init', function () {
        MB_Relationships_API::register( array(
            'id'   => 'post2conf',
            'from' => array(
                'object_type' => 'post',
                'admin_column' => true,  // THIS!
            'to'   => array(
                'object_type' => 'post',
                'post_type'    => 'conference',
                'admin_column' => 'after title', // THIS!
        ) );
    } );

    While i’m a it, I wanted to know if there was a way to create a many to many relationship.
    I’d like to allow my user to link different custom post type between them (conferences, publications, posts, people (not users), etc.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #12591


    Got inside wrong topic


    Anh Tran

    Hi Vee,

    Looks like no relationships table is created. Can you remove your code first, try to deactivate and re-activate the plugin? Just to make sure the plugin creates table successfully.


    Vee Jay

    I tried that but I get the same thing.


    Anh Tran

    Can you check the WordPress database to see if the mb_relationships table is created?

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.