Welcome Guest, Not a member yet? Register   Sign In
Update instead insert
#6

I have tried to organize your coding a bit and asked you a question within the code area below. Could you please check?


PHP Code:
if($this->validate($rules)){

              //$post = $this->request->getPost();

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

              $user_activation_hash $this->$this->request->getVar('user_activation_hash');
              $id_stato_users 1;
              $tipo_utente 1;
              $rand rand(0999999);
              $pin str_pad($rand6'0'STR_PAD_LEFT);

              $data = [
                 'user_activation_hash' => $user_activation_hash,
                 'id_stato_users' => $id_stato_users,
                 'tipo_utente' => $tipo_utente,
                 'pin' => $pin
               
];
              
               $res
=$this->UserModel->save($data); // rename your model please. Name should be capital

                $id_user=$this->UserModel->getInsertID

              log_message('debug',"post_id_user " $id_user);

              $res2=$this->DentistiModel->save($data); // Why saving the same data for a different model? 
Reply


Messages In This Thread
Update instead insert - by pippuccio76 - 01-28-2021, 12:51 PM
RE: Update instead insert - by neoneeco - 01-28-2021, 01:32 PM
RE: Update instead insert - by pippuccio76 - 01-28-2021, 01:34 PM
RE: Update instead insert - by InsiteFX - 01-28-2021, 09:53 PM
RE: Update instead insert - by pippuccio76 - 01-28-2021, 11:07 PM
RE: Update instead insert - by demyr - 01-29-2021, 04:50 AM
RE: Update instead insert - by pippuccio76 - 01-29-2021, 05:05 AM
RE: Update instead insert - by demyr - 01-29-2021, 05:19 AM
RE: Update instead insert - by pippuccio76 - 01-29-2021, 11:18 AM
RE: Update instead insert - by demyr - 01-29-2021, 12:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB