Welcome Guest, Not a member yet? Register   Sign In
Save user activation hash
#2

(This post was last modified: 08-21-2020, 06:54 AM by pippuccio76.)

(08-21-2020, 03:54 AM)pippuccio76 Wrote: hi , how can i save the user activation hash on db ?

this is a part of my controller's method :

PHP Code:
$post $this->request->getPost();

            // generate random hash for email verification (40 char string)
            $user_activation_hash sha1(uniqid(mt_rand(), true));

            $post['user_activation_hash'] = $user_activation_hash;

            $res=$model->save($post); 

every field is stored but user_activation_hash in db are null

Find the error protected $allowedFields user_activation_hash was write bad ...

(08-21-2020, 06:14 AM)pippuccio76 Wrote:
(08-21-2020, 03:54 AM)pippuccio76 Wrote: hi , how can i save the user activation hash on db ?

this is a part of my controller's method :

PHP Code:
$post $this->request->getPost();

            // generate random hash for email verification (40 char string)
            $user_activation_hash sha1(uniqid(mt_rand(), true));

            $post['user_activation_hash'] = $user_activation_hash;

            $res=$model->save($post); 

every field is stored but user_activation_hash in db are null

Find the error protected $allowedFields user_activation_hash was write bad ...

Now i cannot update the data , this is my method inside model :

PHP Code:
function confirm_registration($user_activation_hash){

      //search user with user_activation_hash=$user_activation_hash
      $query=$this->where('user_activation_hash'$user_activation_hash)->get();

      $user=$query->getRow();

      //if ther'arent record
      if(!$user){

          return FALSE;
      }


      $data = array(
              'id_stato_users'=>2,
              'user_activation_hash' => NULL
            
);

      $this->where('id'$user->id);
      $this->update($data);


      if($this->affectedRows()){

          return TRUE;

      }else{

          return FALSE;

      }

         
    


But have this error : There is no data to update. [url=https://www.google.com/search?q=CodeIgniter%5CDatabase%5CExceptions%5CDataException+There+is+no+data+to+update.][/url]
Reply


Messages In This Thread
Save user activation hash - by pippuccio76 - 08-21-2020, 03:54 AM
RE: Save user activation hash - by pippuccio76 - 08-21-2020, 06:14 AM
RE: Save user activation hash - by InsiteFX - 08-21-2020, 12:22 PM
RE: Save user activation hash - by pippuccio76 - 08-23-2020, 01:52 AM
RE: Save user activation hash - by pippuccio76 - 08-23-2020, 07:50 AM
RE: Save user activation hash - by InsiteFX - 08-23-2020, 08:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB