Created
October 14, 2014 11:07
-
-
Save devyfriend/e9912623fd24fdc11fec to your computer and use it in GitHub Desktop.
codeigniter read table and field metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function readDB() | |
| { | |
| $tables = $this->db->list_tables(); | |
| foreach($tables as $table){ | |
| $query = $this->db->field_data($table); | |
| echo '<h5>'.$table.'</h5>'; | |
| echo '<ul>'; | |
| foreach ($query as $field) | |
| { | |
| echo '<li>'.$field->name.' - '.$field->type.' '.($field->primary_key ? '- <b>primary</b>':''). '</li>'; | |
| } | |
| echo '</ul>'; | |
| } | |
| exit; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment