How do I get these SQL queries to run correctly inside of Wordpress?

by Jeremiah Barrett   Last Updated August 13, 2019 21:08 PM

I am trying to query the Gravity Form entries in our database. However, every query I write in PHPMyAdmin doesnt work when moved to Wordpress. For example:

$output = $wpdb->get_results("SELECT COUNT(meta_value) FROM `ps_gf_entry_meta` WHERE form_id = 39 AND meta_key = 17");
<div class="echotest"> <?php  echo($output); ?> </div>

This does output something, however, it's "1" when the correct count should be "3"

Related Questions

Gravity Forms returns to odd position

Updated May 19, 2017 20:08 PM

getting count of selected product in gravity form

Updated June 15, 2018 09:08 AM