MySQL query to get column names?

前端 未结 21 2193
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 01:56

I\'d like to get all of a mysql table\'s col names into an array in php?

Is there a query for this?

21条回答
  •  走了就别回头了
    2020-11-22 02:43

    IN WORDPRESS:

    global $wpdb;   $table_name=$wpdb->prefix.'posts';
    foreach ( $wpdb->get_col( "DESC " . $table_name, 0 ) as $column_name ) {
      var_dump( $column_name );
    }
    

提交回复
热议问题