Blank screen is an indication that some error has occurred and the normally production server hides the errors for security reasons. For quick repair or debugging in production, simply add two lines one that displays the errors and the other one that indicates which of them should be shown.
More information about errors see php wiki .
ini_set('display_error', true);
error_reporting(E_ALL);
I tested your listing code and it showed the following errors in class db
Fatal error: Can not override final method PDO :: __ wakeup ()
This is a magic method and final that can not be overwritten, then comment or remove it.
Fatal error: Access level to WishDB :: __ construct () must be public (as
in class PDO) in
Because the db
class inherits from PDO
you can not decrease the access level of a method / property of the parent class. As the error suggests let the db
constructor be public.
class WishDB extends PDO{
//propriedades omitidas
private function __construct(){
The result of the listing can not be obtained because its method returns a boolean (return from execute()
instead of an array. In case add error handling and an array
public function getWishesByWisherId($wisherID)
{
$consult = $this->prepare("SELECT 'id', 'description', 'due_date' FROM 'wishes' WHERE 'wisherid'=:wisherid");
$consult->bindValue(':wisherid', $wisherID);
return $consult->execute();
}
Remove return $consult->execute();
as per the code below.
if($consult->execute() === false){
print_r($consult->errorInfo());
}
In the list file, change:
$result = WishDB::getInstance()->getWishesByWisherId($wisherID);
while ($row = $result->fetch(PDO::FETCH_ASSOC))
by:
$result = WishDB::getInstance()->getWishesByWisherId($wisherID);
foreach($result as $row)