How to get all tables list in Codeigniter 3?

By Hardik Savani | November 5, 2018 | | 16546 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....




Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: