Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- More information I am trying. Here is the function I am using to get a grade name:
- public function getGrade($id) {
- var_dump($this->connection);
- var_dump($id);
- $sql = "SELECT grade FROM grades WHERE id=5";
- $stmt = $this->connection->prepare($sql);
- var_dump($stmt);
- $stmt->execute(['id' => $id]);
- var_dump($stmt);
- $grade = $stmt->fetchAll();
- var_dump($grade[0]['grade']);
- return $grade->grade;
- }
- And here is the response I get from postman when I run the code:
- C:\Users\tlmar\Documents\GitHub\Phoenix-API\src\Domain\Repository\Security.php:66:
- object(PDO)[156]
- C:\Users\tlmar\Documents\GitHub\Phoenix-API\src\Domain\Repository\Security.php:67:string '5' (length=1)
- C:\Users\tlmar\Documents\GitHub\Phoenix-API\src\Domain\Repository\Security.php:70:
- object(PDOStatement)[158]
- public 'queryString' => string 'SELECT grade FROM grades WHERE id=5' (length=35)
- C:\Users\tlmar\Documents\GitHub\Phoenix-API\src\Domain\Repository\Security.php:72:
- object(PDOStatement)[158]
- public 'queryString' => string 'SELECT grade FROM grades WHERE id=5' (length=35)
- C:\Users\tlmar\Documents\GitHub\Phoenix-API\src\Domain\Repository\Security.php:74:null
- {"success":true,"message":"User successfully retreived","data":{"username":"rhonda","grade":"5","grade_text":null,"department":"5"}}
Advertisement
Add Comment
Please, Sign In to add comment