Blank screen is an indication that an error has occurred and the production server usually hides the errors for security reasons. For quick repair or debug in production just add two lines one that displays errors and the other one that indicates which ones should be shown.
More information about errors see on 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: Cannot override final method PDO::__wakeup()
This is a magical and final which cannot be overwritten, so comment or remove it.
Fatal error: Access level to Wishdb::__Construct() must be public (as
in class PDO) in
As the class db
inherits from PDO
you cannot lower the access level a method/property of the parent class. As the error suggests let the constructor of db
as an audience.
class WishDB extends PDO{
//propriedades omitidas
private function __construct(){
The result of the listing cannot be obtained because its method returns a Boolean(return from execute()
instead of an array. In case add the 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 the return $consult->execute();
according to the code below.
if($consult->execute() === false){
print_r($consult->errorInfo());
}
In the listing file, change:
$result = WishDB::getInstance()->getWishesByWisherId($wisherID);
while ($row = $result->fetch(PDO::FETCH_ASSOC))
for:
$result = WishDB::getInstance()->getWishesByWisherId($wisherID);
foreach($result as $row)
Put in the file where the screen is blank at the beginning:
ini_set('display_error', true); error_reporting(E_ALL);
– rray
@rray insert, but no error was reported.
– Luan Vicente
@rray the page is neither loading nor the form; as if there were no code on the page. When I remove the script require it and the
$wisherID = WishDB:: ...
the form works.– Luan Vicente