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


Updated April 11, 2018 18:08 PM

Updated May 19, 2017 20:08 PM

Updated June 15, 2018 09:08 AM

Updated April 01, 2019 04:08 AM

Updated May 16, 2017 14:08 PM