How to use get_col

I am trying to get all values from database column, using wp get_col(). It seems missing something, here is my query

 global $wpdb;
      $table_name = $wpdb->prefix . 'students';
      $results = $wpdb->get_col("SELECT * FROM $table_name WHERE groups = ''");

  print_r($results);
  //Output Array ( [0] => 24 [1] => 25 [2] => 26 [3] => 27 [4] => 28 [5] => 29 )

I want my query to print the values( name of the groups) How can I correct this?



Read more here: https://stackoverflow.com/questions/65840054/how-to-use-get-col

Content Attribution

This content was originally published by Chris Shabani Muswamba at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: