Creating New Databases and Tables - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Creating New Databases and Tables (/showthread.php?tid=1990) |
Creating New Databases and Tables - El Forum - 07-10-2007 [eluser]BrandonDurham[/eluser] I'm trying to create a new database on the fly and drop a couple of tables into it and I'm having some problems. CI doesn't see to have a way to add tables to a newly-created database via its CI Database functions. I can easily create the new database with: Code: $this->dbutil->create_database($db); But I have no idea how to add tables to that newly-created database. I saw in this thread where Shadowhand mentions using str_replace, but I'm not sure what they mean. Suggestions? I appreciate any help. Thank you. Creating New Databases and Tables - El Forum - 07-10-2007 [eluser]KJTED[/eluser] I'm wondering if you have to use the following to create tables in your database Code: $query = $this->db->query("SOME QUERY"); This isn't something I've had to do and I'm fairly new to CI also but it's worth a try? Check out the database library help pages in the documentation and look at the Custom Function Calls section. KJ Creating New Databases and Tables - El Forum - 07-10-2007 [eluser]BrandonDurham[/eluser] Hmm. Okay, I tried this: Code: // Create database ... and no dice. I get the error "You have specified an invalid database connection group: Test_Coupon_Site_3". Creating New Databases and Tables - El Forum - 07-11-2007 [eluser]KJTED[/eluser] I don't think you are passing a database connection, it looks like it's just a string perhaps. I think you need to set up a connection properly http://ellislab.com/codeigniter/user-guide/database/connecting.html |