DB Create - Execute SQL Command |
[eluser]CI_avatar[/eluser]
I have SQL script imported from phpmyadmin. What I wanted is to execute that script using CI(if there are functions available). Database Forge Class is pretty promising but what I wanted is to execute the script(as string) directly. What are available functions in Database Forge are creating/deleting/editing database and tables. No function is available for executing script with "create database, create table and insert data" SQL command. Please help. Thank you in advance.
[eluser]cideveloper[/eluser]
you dont need to use database forge if you just want to run sql This worked for me Code: $query = $this->db->query("CREATE TABLE test (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,name VARCHAR(255));");
[eluser]CI_avatar[/eluser]
@[email protected] thank you. but the sql command that i am referring includes creating the database. Like this Code: SET FOREIGN_KEY_CHECKS=0; |
Welcome Guest, Not a member yet? Register Sign In |