corillo181 Posted September 22, 2007 Share Posted September 22, 2007 hey i got a code that activate the user profile, but the update is not working is supposed to set the activated from 'n' to 'y' any one knows what? <?php class userActivation{ var $code; var $id; var $db; var $message; function userActivation($code,$id){ $this->code = $code; $this->id = $id; $this->db = new DB(); } function activate(){ $query = "SELECT user_id FROM users WHERE user_id='{$this->id}'"; $result = $this->db->query($query); $getid = $this->db->fetch_array($result); if($getid['user_id']==$this->id){ $query = "SELECT code FROM users WHERE code='{$this->code}'"; $result = $this->db->query($query); $getCode = $this->db->fetch_array($result); if($getCode['code']==$this->code){ //UPDATE IS NOT WORKING $query = "UPDATE users SET activated='y' WHERE code='{$this->code}'"; $result = $this->db->query($query); $this->message = 'your user name has been activated enjoy uploading pictures.'; }else{ $this->message = "Your record was not found please contact the administrator about this problem"; } }else{ $this->message = "Your record was not found please contact the administrator about this problem"; } } } ?> Link to comment https://forums.phpfreaks.com/topic/70252-solved-activation-class/ Share on other sites More sharing options...
corillo181 Posted September 22, 2007 Author Share Posted September 22, 2007 no takers? Link to comment https://forums.phpfreaks.com/topic/70252-solved-activation-class/#findComment-352835 Share on other sites More sharing options...
d22552000 Posted September 22, 2007 Share Posted September 22, 2007 $query = "UPDATE users SET activated='y' WHERE code='{$this->code}'"; is the problem... try uh... IDK I hate MySQL lol $query = "UPDATE users *** activated='y' WHERE code='{$this->code}'"; I know set isnt it... Link to comment https://forums.phpfreaks.com/topic/70252-solved-activation-class/#findComment-352837 Share on other sites More sharing options...
corillo181 Posted September 22, 2007 Author Share Posted September 22, 2007 i test the query out of the class and it works, is inside the class that it does not work. Link to comment https://forums.phpfreaks.com/topic/70252-solved-activation-class/#findComment-352838 Share on other sites More sharing options...
corillo181 Posted September 22, 2007 Author Share Posted September 22, 2007 anyways i got it to work just needed to get the update query out of the variable. Link to comment https://forums.phpfreaks.com/topic/70252-solved-activation-class/#findComment-352839 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.