• Resolved newbiedev

    (@newbiedev)


    Hi

    I’ve created a pod “movies” with “language” as one of the fields.

    Now I’m trying to create a page where I’m trying to filter all movies where language is not “English”.

    I’m using the below code, but getting the error as second code block below. Could you help what am I doing wrong?

    $params = [
    	'limit'   => 25,
    	'where' => 't.language != "English"',
    ];
    $mypod = pods( 'movies', $params );
    
    //$mypod = pods( 'mypod' )->find( $params );
    // Loop through the items returned.
    while ( $mypod->fetch() ) {
    	echo '<p>' . $mypod->display( 'ms_title' ) . '</p>';
    }
    
    Database Error; SQL: SELECT
                    
                    DISTINCT
                    t.*
                    FROM wp_kekc_posts AS t
                    
                    WHERE ( ( t.language != "English" ) AND ( t.post_type = 'movies' ) AND ( t.post_status IN ( 'publish' ) ) )
                    
                    
                    ORDER BY t.menu_order, t.post_title, t.post_date
                    LIMIT 0, 25; Response: Unknown column 't.language' in 'where clause'
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @newbiedev

    Field aren’t object params but metadata so it should be language.meta_value.

    Also, make sure that the actual value is English and not lowercase or and ID.

    Cheers, Jory

    Thread Starter newbiedev

    (@newbiedev)

    Thank you for the support!

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

The topic ‘Getting DB error on using pods () function’ is closed to new replies.