How to get all tables list in Codeigniter 3?

By Hardik Savani | November 5, 2018 | | 1546 Viewer | Category : PHP Codeigniter


It is a amazing deal with database to get all tables list using mysql query in php codeigniter 3 project. this type of task it might be required on big project. So if you require then i think you have knowledge of mysql query. here we will display add the table list using codeigniter mysql query.

We will execute mysql query like as bellow for getting list of all tables in codeigniter. let's just see bellow query.

SHOW TABLES FROM `database_name`

Now you simply run in your controller like this way with codeigniter.

Example:

$tables=$this->db->query("SHOW TABLES FROM `codeig`")->result_array();

foreach($tables as $key => $val) {

echo $val['Tables_in_codeig']."
";

}

Output:

demo_click

demo_viewer

events

item

items

I hope it can help you....




***Do you want me hire for your Project Work? Then Contact US.


We are Recommending you: