Creating New Databases and Tables |
[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.
[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
[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".
[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-gui...cting.html |
Welcome Guest, Not a member yet? Register Sign In |