Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 1 | ########## |
| 2 | Table Data |
| 3 | ########## |
| 4 | |
| 5 | These functions let you fetch table information. |
| 6 | |
| 7 | $this->db->list_tables(); |
| 8 | ========================== |
| 9 | |
| 10 | Returns an array containing the names of all the tables in the database |
| 11 | you are currently connected to. Example:: |
| 12 | |
Joseph Wensley | f24f404 | 2011-10-06 22:53:29 -0400 | [diff] [blame] | 13 | $tables = $this->db->list_tables(); |
| 14 | |
| 15 | foreach ($tables as $table) |
| 16 | { |
| 17 | echo $table; |
| 18 | } |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 19 | |
| 20 | $this->db->table_exists(); |
| 21 | =========================== |
| 22 | |
| 23 | Sometimes it's helpful to know whether a particular table exists before |
| 24 | running an operation on it. Returns a boolean TRUE/FALSE. Usage example:: |
| 25 | |
Joseph Wensley | f24f404 | 2011-10-06 22:53:29 -0400 | [diff] [blame] | 26 | if ($this->db->table_exists('table_name')) |
| 27 | { |
| 28 | // some code... |
| 29 | } |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 30 | |
Joseph Wensley | f24f404 | 2011-10-06 22:53:29 -0400 | [diff] [blame] | 31 | .. note:: Replace *table_name* with the name of the table you are looking for. |