how to write a class for login user in php -


i write function in class login:

function loginuser($mobile,$pas){        $pasw = hash_value($pas);     $sql1 = $this->connection->prepare("select count(*) `user` (`mobile`=:mobile , `pas`=:pas)");     $sql1->execute(array(     ":mobile"=>$mobile,     ":pas"=>$pasw     ));     $num = $sql1->fetchcolumn();     if($num==1){         echo 'login successfully';         }else{         echo 'error';           }          } 

and write code in check.php :

if(isset($_post['mobile'])&&isset($_post['pas'])){    $mobile = check_post($_post['mobile']);    $pas = check_post($_post['pas']);    $login = new login();    $res= $login->loginuser($mobile,$pas); } 

but when enter correct mobile , password in login form, code returns error in screen.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -