javascript - PHP query execute without error but return count 0 -
i creating login in angularjs, in login.phppage verify whether user exist or not number of rows exist or not means using rowcount() in php pdo return 0 result. here php file:
<?php /* * collect details angular http request. */ $postdata = file_get_contents("php://input"); $request = json_decode($postdata); $email = $request->email; $pass = $request->password; $user ="root"; $pass ="m2n1shlko"; $dbh = new pdo('mysql:host=localhost;dbname=blog_db', $user, $pass); $query = $dbh->prepare("select * `signup_tbl` `email`='$email' , `password`='$pass'"); $query->execute(); $count = $query->rowcount(); if($count>0){ echo "you have sucessfully login email: ".$count; //this go under "data" of angular call. }else{ echo "error while authentication email: " .$count; } /* * can use $email , $pass further work. such database calls. */ ?>
data controller here didn't know missing code. apreciate if .. thanks
its $query->rowcount()
; not $query->rowcount();
$count = $query->rowcount(); if($count>0){ echo "you have sucessfully login email: ".$count; //this go under "data" of angular call. }else{ echo "error while authentication email: " .$count; }
read manual rowcount
Comments
Post a Comment