Welcome Guest, Not a member yet? Register   Sign In
Creating basic Register (username/login/password)
#22

[eluser]jvicab[/eluser]
this is the code you posted before. I jus changed the first two lines of your controller constructor and removed your model constructor. Try to see

Controller
<?php
class User extends CI_Controller{
//================ I changed the fisrt to lines of your constructor
function __construct() {
parent::__construct();

$this->view_data[‘base_url’] = base_url();

$this->load->model(‘User_model’);
}

function index() {

$this->register();
}

function register(){

$this->load->library(‘form_validation’);

$this->form_validation->set_rules(‘username’, ‘Username’, ‘required|min_length[5]|max_length[12]|xss_clean’);
$this->form_validation->set_rules(‘name’, ‘Name’, ‘required|min_length[3]|max_length[20]|xss_clean’);
$this->form_validation->set_rules(‘email’, ‘E-mail’, ‘required|min_length[3]|max_length[20]|xss_clean|valid_email’);
$this->form_validation->set_rules(‘password’, ‘Password’, ‘required|min_length[3]|max_length[20]|xss_clean’);
$this->form_validation->set_rules(‘password_conf’, ‘Re-type Password’, ‘required|min_length[3]|max_length[20]|xss_clean|matches[password]’);

if ($this->form_validation->run() == FALSE) {

$this->load->view(‘viewregister’);
}
else {
$username = $this->input->post(‘username’);
$name = $this->input->post (‘name’);
$email = $this->input->post (‘email’);
$password = $this->input->post (‘password’);

********Line 37*********** $this->Usermodel->register_user($username, $name, $email, $password);


}
}
}






Model
<?php

class Usermodel extends CI_Model {

/// ============== I removed your the construct. It is not needed

function register_user($username, $name, $email, $password) {
$shal_password = shal($password);

$query_str = “INSERT INTO tbregister (username, password, name, email) Value (’{$username}’, ‘{$name}’, ‘{$email}’, ‘{password}’)”;

$this->db-query($query_sr, array($username,$name,$email,$shal_password));
}
}


Messages In This Thread
Creating basic Register (username/login/password) - by El Forum - 08-04-2011, 07:19 PM
Creating basic Register (username/login/password) - by El Forum - 08-04-2011, 10:52 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 01:56 AM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 12:25 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 12:35 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 01:32 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:15 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:24 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:35 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:38 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:39 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:45 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:47 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:52 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:54 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 02:56 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:03 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:04 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:05 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:05 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:07 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:09 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:09 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:14 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:15 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:16 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:18 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:21 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:23 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:26 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:27 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:32 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:33 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:35 PM
Creating basic Register (username/login/password) - by El Forum - 08-05-2011, 03:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB