[eluser]steviereal[/eluser]
This has been bothering me for days now and no one else seems to have this problem on the entire web.
It's a database problem. Insert does not seem to work, no matter what I try (active record or not).
It's just submitting a form and inserting its values but nothing happens...
This is the class that's supposed to do the job.
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class RegisterAction {
private $ci;
function __construct(){
$this->ci =& get_instance();
}
public function doRegister($profile, $name, $email, $password) {
$this->ci->load->database();
$this->ci->db->cache_off();
$uid= $name.time();
// This doesn't work :-( :
// $insertquery = "INSERT INTO user (uid, uname,uemail,upass, uprofile) VALUES (".$this->ci->db->escape($uid).", ".$this->ci->db->escape($name).",".$this->ci->db->escape($email).",".$this->ci->db->escape($password).",".$this->ci->db->escape($profile).")";
// var_dump($insertquery);
// error_reporting(E_ALL);
//ini_set('display_errors', '1');
//$result=$this->ci->db->query($insertquery);
//echo "Affected rows: ".$this->ci->db->affected_rows();
//Let's try active record
$data = array(
'uid' => $this->ci->db->escape($uid),
'uname' => $this->ci->db->escape($name),
'uemail' => $this->ci->db->escape($email),
'upass' => $this->ci->db->escape($password),
'uprofile' => $this->ci->db->escape($profile)
);
$this->ci->db->insert('user', $data);
if($this->ci->db->affected_rows() > 0)
{
echo 'Row succesfully inserted, at least that\'s what I think';
}
else {
echo 'Something is wrong. But we don\'t know what for some days now, do we?...';
}
} //end function
}
(Notice I also have to get the CI instance "by force" as $this does not get it.)
It generates the right query though because if I enter the var_dumped query in phpmyadmin it works.