Welcome Guest, Not a member yet? Register   Sign In
getting a syntax error from mysql when run through $this->db->query(...)
#1

[eluser]Unknown[/eluser]
I'm getting a syntax error when I run a query through $this->db->query().
However, I don't get the error when I run it directly in mysql.

Any help would be appreciated.

here is the code

Code:
$name = $this->input->post('name');
  $email = $this->input->post('email');
  $password = $this->input->post('password');

  $sql = "set @salt = floor(rand() * 0xFFFFFFFF);"
   .  "set @hash = sha1(concat('$password',@salt));"
   .  "insert into accounts(`name`, `email`, `password_hash`, `password_salt`, `date_created`) "
   .  "values ('$name', '$email', @hash, @salt, now());";
    
  if($this->db->query($sql)) return $this->try_login();
  
  return $this->db->_error_message();




Theme © iAndrew 2016 - Forum software by © MyBB