CodeIgniter Forums
Active Record "insert" is not working properly - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Active Record "insert" is not working properly (/showthread.php?tid=44022)

Pages: 1 2 3


Active Record "insert" is not working properly - El Forum - 08-03-2011

[eluser]appleboy[/eluser]
Opera and Chrome are working now, so IE can't work?

You can try the following model code:

controller:
Code:
<?php
public function process()
{
        $this->load->helper('security');
        $username = $this->input->post("username");
        $passwd = do_hash($this->input->post("password"));
        $email = $this->input->post("email");    
        $data = array(
            "username" => $username,
            "passwd" => $passwd,
            "email" => $email,
        );
        $this->load->model('members');
        $this->members->register($data);  
        $this->data['title'] = "Registration done!";
        $this->data['msg'] = "A private key of your account has been sent to your email address. Please, enter it in below form to confirm your account.";
            $this->template->render($this->data);
}
?>

Model
Code:
<?php
class Members extends CI_Model {
    public function register($data){
        $this->db->insert('mytable', $data);  
    }
}
?>



Active Record "insert" is not working properly - El Forum - 08-03-2011

[eluser]NeoArc[/eluser]
I think it's a navigator problem.
Show the complete javascript code please.


Active Record "insert" is not working properly - El Forum - 08-03-2011

[eluser]Daksh Mehta[/eluser]
the above code is full one.
Ill try new model tomorrow and update the thread.

thanks all!


Active Record "insert" is not working properly - El Forum - 08-03-2011

[eluser]NeoArc[/eluser]
Hmm, how do you invoke the Register::process() method? Using Ajax / form request?


Active Record "insert" is not working properly - El Forum - 08-05-2011

[eluser]Daksh Mehta[/eluser]
Thank you all.

No, i am invoking the process() normally through CI url structure.
ie. http://localhost/app/index.php/register/process


Active Record "insert" is not working properly - El Forum - 08-05-2011

[eluser]waynhall[/eluser]
So, to clarify...

It works fine in Opera and Chrome, but not in IE? or Firefox?


Active Record "insert" is not working properly - El Forum - 08-05-2011

[eluser]Daksh Mehta[/eluser]
only in FF is not working...

Sad


Active Record "insert" is not working properly - El Forum - 08-05-2011

[eluser]waynhall[/eluser]
Is it not working when Firebug is closed, or only when it is open?


Active Record "insert" is not working properly - El Forum - 08-06-2011

[eluser]Daksh Mehta[/eluser]
its same even if i turn off each and every addon!


Active Record "insert" is not working properly - El Forum - 08-06-2011

[eluser]waynhall[/eluser]
Although this shouldn't be necessary in a well-written program, this workaround may solve your issue for now:

Code:
<?php
class Members extends CI_Model {
    
    public function register($username, $password, $email){
        
        if($username && $password && $email) {  // check if they exist and aren't 0 or FALSE
            // you could also try:
            // if(!empty($username) && !empty($password) && !empty($email)){}
            
            $sqlq = "INSERT INTO members VALUES(?, ?, ?, ?)";
            $this->db->query($sqlq, array(NULL, $username, $password, $email));  
        }
          
    }
}