Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
99 views
in Technique[技术] by (71.8m points)

php - 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?

question from:https://stackoverflow.com/questions/65840054/how-to-use-get-col

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...