I wrote this simple php script that just to import basic information from mysql table. As a result, not even a error message, but a blind screen. When I suppress the DB code, php code works just fine and is displayed. Something to do with the PHP - Mysql connection, but cant determine it since:
- Apache2 is installed and is working (2.2.22)
- PHP and Mysql are installed with php5-msql bundle (last version 5.3.10).
- PhpMyAdmin seems to work fine.
Anything else ? Thanks
<p> Voici le resultat de la verification:
<?php
if ($_POST ['password'] == "XXXXXX")
{
echo "Vous avez ete identifie avec le mot de passe" . htmlspecialchars($_POST['password']);
}
else
{
echo "Vous avez echoue";
}
?>
</p>
<p> Si tu veux retenter ta chance, <a href="Password.php"> clique ici </a>
</p>
<?php
try
{
//Connexion à Mysql
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', 'XXXXX');
}
catch(Exception $e)
{
// Exception pour erreur
die ('Erreur : ' .$e->getMessage());
}
// Si tout va bien récuperation de la table
$reponse = $bdd->query('SELECT * FROM billets');
// On affiche les entrees une à une
while ($donnees = $reponse->fetch())
{
?>
<p>
<strong> Livraison du contenu de chat </strong>
<?php echo $donnees ['titre']; ?>
a laissé le message suivant
<?php echo $donnees ['contenu']; ?>
</p>
}
<?php
$reponse->closeCursor(); // termine le traitement
?>