Fatal error: Using $this when not in object context in /home/celavie2017/public_html/register.php on line 169 -
i writing code registering users on website. keep getting error. code: line 150-180.
$stmt = $db->prepare('select email users email = :email'); $stmt->execute(array(':email' => $_post['email'])); $row = $stmt->fetch(pdo::fetch_assoc); $stmt->execute(array(':email' => $_post['email'])); $row = $stmt->fetch(pdo::fetch_assoc); if(!empty($row['email'])){ $error[] = 'email provided in use.'; ?>
//hash password $hash = password_hash($password, password_bcrypt, array("cost" => 10)); //create activation code $activasion = md5(uniqid(rand(),true)); ?> <? if($this->input->post()) $data = array( 'username' => $this->input->post('username'), 'email' => $this->input->post('email'), 'password' => $hash, 'role' => $this->input->post('roles') ); $this->your_model->add_user($data); ?> <? function add_user($data) return $this->db->insert('login', $data);
`
line 169= if($this->input->post())
"$this" available within object context.
<?php //class class foo { //property private $bar = 'gold'; //method public function getbar() { return $this->bar; } } ?>
see classes , objects - basics more information
Comments
Post a Comment