mysql - Codeigniter: "Table not found" error when data inserted after database creation -


i'm making installer module codeigniter application.

i'm creating mysql database , it's tables through code , want insert user credentials db during installation process. this:

enter image description here

the problem i'm having after creation of database , it's tables, when try insert user info database gives error saying "the table 'user' doesn't exist" while table exists.

here code:

$this->load->dbforge();  //create database $this->install_model->use_sql_string();   //add tables .sql file  $this->load->database($database_name);  //load created database  $this->install_model->add_the_user($username, $password));  //insert user data 

the database , tables being created correctly. last line of code gives error.

i have no idea i'm doing wrong here. please help!

i think should load database first, u should import .sql file. table created in loaded db.

$this->load->dbforge();  //create database $this->load->database($database_name);  //load created database $this->install_model->use_sql_string();   //add tables .sql file $this->install_model->add_the_user($username, $password));  //insert user data 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -