Probleme execution code php
Bonjour,
Je developpe un site web et je souhaite recuperer les données à partir d'une bd mysql afin de pouvoir les utiliser. La connexion à la base marche bien mais lorsque je lance ma page (.php), c'est tout le code qui vient après les deux lignes de connection à la base et la selection qui est affiché. C'est comme si mon code php n'est pas bien executé.
Voici mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Code php : echo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h2>Code PHP</h2>
<p>
<?php
$host="localhost:3308";
$login="root";
$mp="";
$nom="stage";
try
{
$base=new PDO('mysql:host=localhost:3308;dbname=stage', 'root', '');
}
catch(Exception $e)
{
die('Erreur: ' .$e->getMessage());
}
//$rep=$base->query('select * from concept where idCpt <100');
$heure=$base->query('select heure_legale from lorient_1h_brut');
$debit=$base->query('select DUPLEIX_QTH_Debit_Traite_1h__A_ from lorient_1h_brut');
/*while($data=$rep->fetch())
{
echo $data['idCpt'] . '<br />';
}*/
while($data2=$heure->fetch())
{
//echo $data2['heure_legale'] . '<br />';
$date[]=$data2['heure_legale'];//tableau 1
}
$heure->closeCursor();
while($data3=$debit->fetch())
{
$deb[]=$data3['DUPLEIX_QTH_Debit_Traite_1h__A_']; //tableau 2
}
$debit->closeCursor();
$taillex=count(date);
$tailley=count(deb);
echo $taillex;
echo $tailley;
//$rep->closeCursor();
//echo "javascript:cercle();";
?>
</p>
</body>
</html> |
Et voici ce qui est affiché lorsque je lance ma page:
Code PHP
Code:
1 2 3 4
|
getMessage()); } //$rep=$base->query('select * from concept where idCpt <100'); $heure=$base->query('select heure_legale from lorient_1h_brut'); $debit=$base->query('select DUPLEIX_QTH_Debit_Traite_1h__A_ from lorient_1h_brut'); /*while($data=$rep->fetch()) { echo $data['idCpt'] . '
'; }*/ while($data2=$heure->fetch()) { //echo $data2['heure_legale'] . '
'; $date[]=$data2['heure_legale'];//tableau 1 } $heure->closeCursor(); while($data3=$debit->fetch()) { $deb[]=$data3['DUPLEIX_QTH_Debit_Traite_1h__A_']; //tableau 2 } $debit->closeCursor(); $taillex=count(date); $tailley=count(deb); echo $taillex; echo $tailley; //$rep->closeCursor(); //echo "javascript:cercle();"; ?> |
Si quelqu'un à une idée là dessus, elle sera la bienvenue.
Merci