Php pdo comment page display blank

Php pdo comment page display blank
0

sorry for my English.

My knowledge about the database is very seample.

I have to come this code from a Forum.

I have Two Files, one the Php, then another where the comment is.

Now have two problems:

1 - The comment page display blank.

2 - when anyone writes a comment, it shows on all Website, when I to wish that it only to display on the File where it writes.

The code part where to forward to set to the database,

function getMessages()
{
	if ( ! $this -> dbh ) {
		$this -> getConnection();
	}

    $sql = "SELECT * FROM commentar WHERE site = :site ORDER BY datetime DESC";
    $sth = $this->dbh->prepare( $sql, array( PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY ));
    $sth -> execute( array(':site' => $site ));
    
    $result = $sth->fetchAll(PDO::FETCH_ASSOC );
    if ( false === $result ) {
        $this->reportPDOError( "fetchAll(ASSOC) failed", $sql );
    }
    foreach ($result as $message) {

 ?>


 <p><strong>From: </strong> <?=htmlspecialchars( $message['name'] ) ?>            
 <strong>at: </strong> <?=htmlspecialchars( $message['datetime'] ); ?></p>
 <p><?=htmlspecialchars( $message['message'] ); ?></p><hr>


<?php
	}    
  }
}

All Code is here

The file comment calls the php file with this command,

<?php

  $object = new ClassProveContakt3("1");
?>  

Can please someone help me with this problem, Thanks!