[CodeIgniter]テーブルのカラムのコメント取得
テーブルのカラムのコメント取得
/application/core/MY_Model.phpとかに実装
public function get_column_comments($table = '') { if(empty($table)){ $table = $this->name; } $query = "SELECT COLUMN_NAME,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '$table' AND table_schema = '{$this->db->database}'"; $result = $this->db->query($query); $result = $result->result('array'); $tmp = array(); foreach($result as $array){ $tmp[$array['COLUMN_NAME']] = $array['COLUMN_COMMENT']; } return $tmp; }