1
I created an installer for my system it installs normal, but before finishing the installation the error occurs
Error Number: 1046
No database selected
CREATE TABLE IF NOT EXISTS `auditoria` ( `id` int(11) NOT NULL AUTO_INCREMENT,
`usuario` varchar(45) NOT NULL,
`data_hora` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`operacao` varchar(45) NOT NULL, `query` text NOT NULL,
`observacao` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Filename: C:\wamp\www\ehpcms\system\database\DB_driver.php
Line Number: 330
Follow my controller install.php
I suggest you improve your script. What you are is called DB Migration (Application create DB structure). There are some ways to do it, but the wrong way to do it is from the controller.
– gmsantos
@Can you give me a hand then? Or at least help me to fix this file even, I’m starting now, so for didactic purposes already helps me.
– Eduardo Paludo
my guess is that the moment the controller runs, Codeigniter loads the information from the config files and after you create the new file with the configs, it has not yet been loaded by the framework. That explains him spinning the second time.
– gmsantos
One approach you can use is to split the installation into two Steps: one first for the configs and one next for the tables.
– gmsantos
Another suggestion, even though it is easy to use the framework, try to learn how to do some things by hand, pure PHP. Didactically you have more to gain and will know if face the difference between
write_file
of the IC andfile_put_contents
of PHP– gmsantos
I share the same opinion. 1º log in with the data, submit the form and create the files, and then run to create the tables
– Papa Charlie
A place to start: http://br.phptherightway.com/ :)
– gmsantos
I will first try to submit the form before and then create the tables, let’s see if I can
– Eduardo Paludo