Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • @kopas

    I’ve got a problem in modifyng the plugin with your instructions. In fact using your code I’ve got this error from MySQL:

    ” Unknown column ‘wp_term_relationships.term_taxonomy_id’ in ‘on clause’] ”

    because you put the 2 LEFT JOIN in a bad order.
    The LEFT JOIN correct syntax is

    SELECT fields FROM first_table LEFT JOIN second_table ON first_table.primary_key = second_table_external_key

    And so the correct LINE 59 is:

    if ($categories) {
    $sql .= "LEFT JOIN $tableterm_relationships ON ($tableposts.ID = $tableterm_relationships.object_id) LEFT JOIN $tableterm_taxonomy ON ($tableterm_relationships.term_taxonomy_id = $tableterm_taxonomy.term_taxonomy_id)";
    $cats = explode(' ', $categories);
    }

    Everything works correctly with this line for me.

    I’ve got a problem in modifyng the plugin with the instructions given by Adam on Lorelle’s blog on WordPress.com

    ” Unknown column ‘wp_term_relationships.term_taxonomy_id’ in ‘on clause’] ”

    because the 2 LEFT JOIN in a bad order.
    The LEFT JOIN correct syntax is

    SELECT fields FROM first_table LEFT JOIN second_table ON first_table.primary_key = second_table_external_key

    And so the correct LINE 59 is:

    if ($categories) {
    $sql .= "LEFT JOIN $tableterm_relationships ON ($tableposts.ID = $tableterm_relationships.object_id) LEFT JOIN $tableterm_taxonomy ON ($tableterm_relationships.term_taxonomy_id = $tableterm_taxonomy.term_taxonomy_id)";
    $cats = explode(' ', $categories);
    }

    Everything works correctly with this line for me.

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