Trying to create a relationship ends in SQL Error

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12572
    Vee JayVee Jay
    Participant

    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.)

    #12591
    crispedgecrispedge
    Participant

    Got inside wrong topic

    #12622
    Anh TranAnh Tran
    Keymaster

    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.

    #12634
    Vee JayVee Jay
    Participant

    I tried that but I get the same thing.

    #12635
    Anh TranAnh Tran
    Keymaster

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.