API错误 - 遇到非数字值

I am using wordpress Version 4.9.6 and trying to create the following API:

However, when accessing the api via

http://localhost/demo_wordpress_api/wp-json/product/v1/manageproduct?category=computer

Find below my minimum viable example:

<?php
add_action('rest_api_init', 'productRoutes');

function productRoutes()
{
    register_rest_route('product/v1', 'manageproduct', array(
        'methods' => WP_REST_SERVER::READABLE,
        'callback' => 'allproductitability',
    ));
}

function allProductsByCategory($data)
{
    global $wpdb;

    // show db errors
    $wpdb->show_errors(true);
    $wpdb->print_error();

    // $data['term']

    $mainQuery = $wpdb->get_results( "SELECT *
    FROM wp_product_API
    WHERE id IN(
        SELECT MAX(id)
        FROM wp_product_API
        WHERE category = \" " + $data['category'] + " \"
        GROUP BY id)  
    ORDER BY price DESC
    LIMIT 1;" );

When I run this I get the following error:

Warning: A non-numeric value encountered

I get the error where I am inserting my parameter into my SQL Query:

    $mainQuery = $wpdb->get_results( "SELECT *
    FROM wp_product_API
    WHERE id IN(
        SELECT MAX(id)
        FROM wp_product_API
        WHERE category = \" " + $data['category'] + " \" // ON THIS LINE I GET THE ERROR
        GROUP BY id)  
    ORDER BY price DESC
    LIMIT 1;" );

Any suggestions why I get the error on this line?

I appreciate your replies!

The problem is that you are using the wrong operator for concatenation. In PHP . is what you should use like this:

$mainQuery = $wpdb->get_results( "SELECT *
FROM wp_product_API
WHERE id IN(
    SELECT MAX(id)
    FROM wp_product_API
    WHERE category = \" " . $data['category'] . " \" // ON THIS LINE I GET THE ERROR
    GROUP BY id)  
ORDER BY price DESC
LIMIT 1;" );