Stack Overflow Asked by Tu-Ai Le on January 5, 2021
I am experiencing a problem where I can’t use the parameter in the function in other functions more specifically the $studentnumber parameter, is it possible for the parameters used in other functions, the parameter used were dynamic parameter. I’m new to PHP so my terminology might be off I the end goal is to make $studentnumber, able to be used in other functions.
public function login($studentnumber, $password) {
$conn = dbconnection();
$stmt = $conn->prepare("SELECT * FROM login WHERE studentnumber = :studentnumber");
$stmt->bindParam(':studentnumber', $studentnumber);
$stmt->execute();
$row = $stmt->fetch();
if ($password == $row['password']) {
echo $studentnumber;
return true;
} else {
return false;
}
}
public function login($studentnumber, $password) {
$this->studentnumber = $studentnumber;
$conn = dbconnection();
$stmt = $conn->prepare("SELECT * FROM login WHERE studentnumber = :studentnumber");
$stmt->bindParam(':studentnumber', $studentnumber);
$stmt->execute();
$row = $stmt->fetch();
if ($password == $row['password']) {
echo $this->studentnumber;
return true;
} else {
return false;
}
}
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP