Here is the error DbOperations. php
codes:
public function
getUserByUserid($user_id){
$stmt = $this->con->prepare("SELECT * FROM
mydb.User WHERE user_id = ?" );
$stmt->bind_param("s",
$user_id);
return
$stmt->get_result()->fetch_assoc();
}
In
another userLogin.php, i use the getUserByUserid($user_id)
here:
if($db->userLogin($_POST['user_id'],
$_POST['password'])){
$user =
$db->getUserByUserid($_POST['user_id']);
$response['error'] =
false;
$response['user_id'] = $user['user_id'];
$response['name']
= $user['name'];
$response['contact_no'] = $user['contact_no'];
$response['email'] = $user['email'];
$response['role'] =
$user['role'];
And
this is the error
message:
Fatal
error: Call to a member function fetch_assoc() on a non-object
in
C:\xampp\htdocs\Android\includes\DbOperations.php on
line
41
Line
41 is : return
$stmt->get_result()->fetch_assoc();
Not
sure what is the fetch_assoc() issue and i am a beginner...Thank you for
helping:)
No comments:
Post a Comment