This plugin function I'm working on parses a CSV file, and outputs it as an HTML table; in addition to that, it also queries a database and gets values for one of the columns.
Every other part of the script seems to run fine, and does what I need it to, except for the database query portion:
$newdb = new wpdb( 'user', 'password', 'db', 'localhost' );
$results = $newdb->get_results("SELECT ItemID, Price FROM $table WHERE ItemID = $quanid GROUP BY Price ORDER BY COUNT(*) DESC LIMIT 1");
echo('<td>');
echo($results);
echo('</td>');
$results is displayed as "Array" in the HTML output.
function create_table_form() {
$handle = fopen( plugin_dir_path( __FILE__ )  . 'example.csv' , "r" );  
$data = fgetcsv($handle, 1000, ",");
echo('<input type="text" class="search" id="search" placeholder="Search">');
echo('<br>');
echo('<table id="table">    <tr class="hidden">
    <th><b>
        Name</b>
    </th>
    <th><b>
        Fudge</b>
    </th>
    <th><b>
        Price</b>
    </th>
    <th><b>Vote</b>
    </th>
</tr>
<tbody>');
$a = 1;
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    $name = $data[0];
    $quanid = $data[2];
    $table = $data[3];
    unset($data[2]);
    unset($data[3]);
    //generate HTML
    echo('<tr>');
    foreach ($data as $index=>$val) {
        echo('<td>');
        echo htmlentities($val, ENT_QUOTES);
        echo('</td>');
    }
    $newdb = new wpdb( 'user', 'password', 'db', 'localhost' );
    $results = $newdb->get_results("SELECT ItemID, Price FROM $table WHERE ItemID = $quanid GROUP BY Price ORDER BY COUNT(*) DESC LIMIT 1");
    echo('<td>');
    echo($results);
    echo('</td>');
    echo('<td>
        <button class="toggler" data-prod-cat="' . $cssId . '">Vote</button>
    </td>');
    echo('</tr>');
    echo('<tr class="cat' . $cssId . ' hidden" style="display:none">');
    echo('<td colspan="4" style="white-space: nowrap">Enter ' . $name . ' Price:
    <input type="text" maxlength="4" name="' . $quanid . '" value="" class="input" /> 
    <button class="submit" type="submit" value="Submit">Submit</button>
    </td>
    </tr>');
    $cssId = 'row-'.$a;
$a++;
}
echo("</table>");
fclose($handle);
}