Venky967 Posted February 22, 2017 Share Posted February 22, 2017 In order to create a database table I have a function like this public function installDb() { return (Db::getInstance()->execute(' CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'sampletable` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `password` varchar(255) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `TRANSUNION_CONFIGURE_DETAILS_USERNAME` (`username`) ) ENGINE = '._MYSQL_ENGINE_.' CHARACTER SET utf8 COLLATE utf8_general_ci;')); } By doing this ,after my module installation a single table named "sampletable" is created.Now I want multiple tables to be created.How to achieve it? Thank you. Link to comment Share on other sites More sharing options...
BalzoT Posted February 22, 2017 Share Posted February 22, 2017 Yes you can! just put you code like this public function installDb(){ return (Db::getInstance()->execute('QUERY') && Db::getInstance()->execute('QUERY2') && ...); } 1 Link to comment Share on other sites More sharing options...
Venky967 Posted February 23, 2017 Author Share Posted February 23, 2017 Thanks for your instant answer .It's working fine. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now