[eluser]riwakawd[/eluser]
I have tried to load my migrations with input post, number for my migrations is 002_user;
I thought I might of been able to do it via migrations. Not inserting data in to user table
Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_User extends CI_Migration {
public function up() {
if(!$this->db->table_exists('user')) {
$this->db->insert('user',
array('username' => $this->input->post('username'),
'password' => sha1($this->input->post('password')),
'email' => $this->input->post('email')
));
}
}
public function down(){
}
}
Controller
Code:
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'trim|shar1|required|xss_clean');
$this->form_validation->set_rules('email', 'Email', 'required');
if ($this->form_validation->run() == false) {
$this->load->view('template/step_5', $data);
} else {
$this->load->library('migration');
if($this->migration->version(2) == true) {
redirect('setup/step_6');
} else {
redirect('setup/error');
}
}
It can work in the controller by adding this
Code:
if ($this->form_validation->run() == false) {
$this->load->view('template/step_5', $data);
} else {
$this->db->insert('user', array('username' => $this->input->post('username'),'password' => sha1($this->input->post('password')),'email' => $this->input->post('email')));
redirect('setup/step_6');
}