codeigniter
composer create-project codeigniter4/appstarter --no-dev
codeigniter
composer create-project codeigniter4/appstarter --no-dev
codeigniter
<h2><?php echo $title; ?></h2>
<?php echo validation_errors(); ?>
<?php echo form_open('news/create'); ?>
<label for="title">Title</label>
<input type="text" name="title" /><br />
<label for="text">Text</label>
<textarea name="text"></textarea><br />
<input type="submit" name="submit" value="Create news item" />
</form>
codeigniter
This is default database :
$db['default'] = array(
....
....
'database' => 'mydatabase',
....
);
Add another database at the bottom of database.php file
$db['second'] = array(
....
....
'database' => 'mysecond',
....
);
In autoload.php config file
$autoload['libraries'] = array('database', 'email', 'session');
The default database is worked fine by autoload the database library but second database load and connect by using constructor in model and controller...
<?php
class Seconddb_model extends CI_Model {
function __construct(){
parent::__construct();
//load our second db and put in $db2
$this->db2 = $this->load->database('second', TRUE);
}
public function getsecondUsers(){
$query = $this->db2->get('members');
return $query->result();
}
}
?>
codeigniter
composer create-project codeigniter4/appstarter project-root
codeigniter
composer update
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us