Get db name - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Get db name (/showthread.php?tid=78986) |
Get db name - pippuccio76 - 04-05-2021 hi sorry for english , there is a way to get db name ? i have this code to get db table : Code: $db = \Config\Database::connect(); Can i get the name to use in this method ? i know that db name are in .env but i want create a tool and i must get it RE: Get db name - InsiteFX - 04-05-2021 If you just need the current database name, you can use MySQL's SELECT DATABASE() command. This is not tested but give it a try. PHP Code: $dbname = $db->query("SELECT DATABASE()"); RE: Get db name - nfaiz - 04-05-2021 (04-05-2021, 07:12 AM)pippuccio76 Wrote: hi sorry for english , there is a way to get db name ? PHP Code: $dbname = $db->database; |