Commit 162f17b2 authored by Gaetan Carabetta's avatar Gaetan Carabetta

update website

parent 3213e039
...@@ -79,8 +79,9 @@ INSERT INTO espece (nomEspece,nomClasse) VALUES ('hamster','mammifere'); ...@@ -79,8 +79,9 @@ INSERT INTO espece (nomEspece,nomClasse) VALUES ('hamster','mammifere');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('chat','mammifere'); INSERT INTO espece (nomEspece,nomClasse) VALUES ('chat','mammifere');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('lapin','mammifere'); INSERT INTO espece (nomEspece,nomClasse) VALUES ('lapin','mammifere');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('chien','mammifere'); INSERT INTO espece (nomEspece,nomClasse) VALUES ('chien','mammifere');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('souri','mammifere'); INSERT INTO espece (nomEspece,nomClasse) VALUES ('souris','mammifere');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('tortue','autres'); INSERT INTO espece (nomEspece,nomClasse) VALUES ('tortue','autres');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('dragon','autres');
INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Nita',3079,62,'2018-07-26',12,'lapin'); INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Nita',3079,62,'2018-07-26',12,'lapin');
...@@ -101,7 +102,8 @@ INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Lune ...@@ -101,7 +102,8 @@ INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Lune
INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Alma',2031,100,'2011-08-28',5,'chat'); INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Alma',2031,100,'2011-08-28',5,'chat');
INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Teegan',2915,77,'2013-04-29',1,'hamster'); INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Teegan',2915,77,'2013-04-29',1,'hamster');
INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Talon',1931,82,'2011-05-01',4,'lapin'); INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Talon',1931,82,'2011-05-01',4,'lapin');
INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Tatiana',2304,77,'2019-01-11',12,'souri'); INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Tatiana',2304,77,'2019-01-11',12,'souris');
INSERT INTO animal (nom,poids,taille,naissance,idClient,especeNom) VALUES ('Osvaldo',9999,15,'2010-05-24',2,'dragon');
...@@ -178,8 +180,8 @@ INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chien','TAHOR'); ...@@ -178,8 +180,8 @@ INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chien','TAHOR');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','DAFALGAN'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','DAFALGAN');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('hamster','SPASFON'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('hamster','SPASFON');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','ISIMIG'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','ISIMIG');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souri','KARDEGIC'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souris','KARDEGIC');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souri','LEVOTHYROX'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souris','LEVOTHYROX');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('hamster','DOLIPRANE'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('hamster','DOLIPRANE');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('hamster','KARDEGIC'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('hamster','KARDEGIC');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chien','SPASFON'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chien','SPASFON');
...@@ -189,7 +191,7 @@ INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chat','SPASFON'); ...@@ -189,7 +191,7 @@ INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chat','SPASFON');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('tortue','KARDEGIC'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('tortue','KARDEGIC');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chat','EFFERALGAN'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chat','EFFERALGAN');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','EFFERALGAN'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','EFFERALGAN');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souri','TAHOR'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souris','TAHOR');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','IMODIUM'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','IMODIUM');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chat','TAHOR'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chat','TAHOR');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','DOLIPRANE'); INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','DOLIPRANE');
......
...@@ -2,58 +2,58 @@ ...@@ -2,58 +2,58 @@
<head> <head>
<title>Clinique Vétérinaire</title> <title>Clinique Vétérinaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<h1>Ajout d'un Traitement</h1>
<?php <?php
// Connexion à la base de données
include("connexion.php"); include("connexion.php");
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
try{
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
} catch(PDOException $e){
echo "Erreur de connexion '$e'";
}
try{
$idAnimal = $_POST['animal'];
$idVeterinaire = $_POST['veterinaire'];
$medicament = $_POST['medicament'];
$date = $_POST['ddebut'];
$duree = $_POST['duree'];
$qte = $_POST['qteJour'];
if($qteJour!=""){
if($idAnimal != ""){
if($idVeterinaire != ""){
if($medicament != ""){
if($date != ""){
if($duree != ""){
$vSql ="INSERT INTO TRAITEMENT (idAnimal,idVeterinaire) VALUES ('$idAnimal','$idVeterinaire');";
$vSt = $vConn->prepare($vSql);
$vSt->execute();
$vSql ="INSERT INTO POSOLOGIE (idTraitement,nomMolec,debut,duree,nbJourna) VALUES ((SELECT idTraitement FROM TRAITEMENT WHERE idAnimal='$idAnimal' AND idVeterinaire='$idVeterinaire'),'$medicament','$date','$duree','$qte');";
$vSt = $vConn->prepare($vSql);
$vSt->execute();
header('Location: http://tuxa.sme.utc/~bdd0p042/application/traitements.php');
}else
echo "Il faut donner une durée";
}else
echo "Il faut donner une date";
}else
echo "Il faut donner un médicament";
}else
echo "Il faut donner un vétérinaire";
}else
echo "Il faut donner un animal";
}else{
echo "Il faut donner la quantité"
}
} catch(PDOException $e){
echo "Erreur d'insertion '$e'";
}
?> ?>
<div>
<form action="addTraitement.php" method="post">
<p>Animal:
<select name="animal" required/>
<?php
$vSql ='select idAnimal from Animal;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p>ID Vétérinaire:
<select name="veterinaire" required/>
<?php
$vSql ='select idVeterinaire from Veterinaire;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p>Médicament:
<select name="medicament" required/>
<?php
$vSql ='select nomMolec from Medicament;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p>Date de debut: <input type="date" name="ddebut" required/></p>
<p>Durée: <input type="number" name="duree" required/></p>
<p>Quantité par jour: <input type="number" name="qteJour" required/></p>
<p><input type="submit" value="OK"></p>
</form>
</div>
</body> </body>
</html> </html>
...@@ -9,6 +9,7 @@ if ($_POST['affiche'] == "all"){ ...@@ -9,6 +9,7 @@ if ($_POST['affiche'] == "all"){
include("animaux.php"); include("animaux.php");
include("medicaments.php"); include("medicaments.php");
include("traitements.php"); include("traitements.php");
include("posologie.php");
} elseif ($_POST['affiche'] == "clients") { } elseif ($_POST['affiche'] == "clients") {
include("clients.php"); include("clients.php");
} elseif ($_POST['affiche'] == "veterinaires") { } elseif ($_POST['affiche'] == "veterinaires") {
...@@ -25,6 +26,8 @@ if ($_POST['affiche'] == "all"){ ...@@ -25,6 +26,8 @@ if ($_POST['affiche'] == "all"){
include("medicaments.php"); include("medicaments.php");
} elseif ($_POST['affiche'] == "traitements") { } elseif ($_POST['affiche'] == "traitements") {
include("traitements.php"); include("traitements.php");
} elseif ($_POST['affiche'] == "posologie") {
include("posologie.php");
} }
?> ?>
<html>
<head>
<title>Clinique Vétérinaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
include("connexion.php");
try{
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
} catch(PDOException $e){
echo "Erreur de connexion '$e'";
}
try{
$idAnimal = $_POST['animal'];
$idVeterinaire = $_POST['veterinaire'];
$medicament = $_POST['medicament'];
$date = $_POST['ddebut'];
$duree = $_POST['duree'];
$qte = $_POST['qteJour'];
if($qteJour!=""){
if($idAnimal != ""){
if($idVeterinaire != ""){
if($medicament != ""){
if($date != ""){
if($duree != ""){
$vSql ="INSERT INTO TRAITEMENT (idAnimal,idVeterinaire) VALUES ('$idAnimal','$idVeterinaire');";
$vSt = $vConn->prepare($vSql);
$vSt->execute();
$vSql ="INSERT INTO POSOLOGIE (idTraitement,nomMolec,debut,duree,nbJourna) VALUES ((SELECT idTraitement WHERE idAnimal='$idAnimal' AND idVeterinaire='$idVeterinaire'),'$medicament','$date','$duree','$qte');";
$vSt = $vConn->prepare($vSql);
$vSt->execute();
header('Location: http://tuxa.sme.utc/~bdd0p042/application/animaux.php');
}else
echo "Il faut donner une durée";
}else
echo "Il faut donner une date";
}else
echo "Il faut donner un médicament";
}else
echo "Il faut donner un vétérinaire";
}else
echo "Il faut donner un animal";
}else{
echo "Il faut donner la quantité"
}
} catch(PDOException $e){
echo "Erreur d'insertion '$e'";
}
?>
</body>
</html>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<h1>Information des animaux</h1> <h1>Information sur les animaux</h1>
<table border="1"> <table border="1">
<tr> <tr>
<th>idAnimal</th> <th>idAnimal</th>
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
try{ try{
$vSt = $vConn->prepare($vSql); $vSt = $vConn->prepare($vSql);
$vSt->execute(); $vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) { while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>'; echo '<tr>';
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<h1>Information des assitants</h1> <h1>Information sur les assitants</h1>
<table border="1"> <table border="1">
<tr> <tr>
<th>idAssistant</th> <th>idAssistant</th>
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
$vSt = $vConn->prepare($vSql); $vSt = $vConn->prepare($vSql);
$vSt->execute(); $vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) { while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>'; echo '<tr>';
echo "<td>$vResult[0]</td>"; echo "<td>$vResult[0]</td>";
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<h1>Information des classes</h1> <h1>Information sur les classes</h1>
<table border="1"> <table border="1">
<tr> <tr>
<th>Nom Classe</th> <th>Nom Classe</th>
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
try{ try{
$vSt = $vConn->prepare($vSql); $vSt = $vConn->prepare($vSql);
$vSt->execute(); $vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) { while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>'; echo '<tr>';
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<h1>Information des clients</h1> <h1>Information sur les clients</h1>
<table border="1"> <table border="1">
<tr> <tr>
<th>idClient</th> <th>idClient</th>
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
$vSt = $vConn->prepare($vSql); $vSt = $vConn->prepare($vSql);
$vSt->execute(); $vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) { while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>'; echo '<tr>';
echo "<td>$vResult[0]</td>"; echo "<td>$vResult[0]</td>";
......
<?php <?php
$vHost = 'tuxa.sme.utc'; $vHost = 'tuxa.sme.utc';
$vPort = '5432'; $vPort = '5432';
$vData = 'dbbdd0p042'; $vData = 'dbbdd0p000';
$vUser = 'bdd0p042'; $vUser = 'bdd0p000';
$vPass = 'cyLu9JFl'; $vPass = '';
?> ?>
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<h1>Information des especes</h1> <h1>Information sur les especes</h1>
<form action='statEspeces.php' method='post'> <input type='submit' value='Statistiques générales'> </form>
<table border="1"> <table border="1">
<tr> <tr>
<th>Classe</th> <th>Classe</th>
<th>Espece</th> <th>Espece</th>
<th>Statistique</th>
</tr> </tr>
<?php <?php
// Connexion à la base de données // Connexion à la base de données
...@@ -27,11 +29,11 @@ ...@@ -27,11 +29,11 @@
$vSt = $vConn->prepare($vSql); $vSt = $vConn->prepare($vSql);
$vSt->execute(); $vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) { while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>'; echo '<tr>';
echo "<td>$vResult[0]</td>"; echo "<td>$vResult[0]</td>";
echo "<td>$vResult[1]</td>"; echo "<td>$vResult[1]</td>";
echo "<td><form action='statEspece.php' method='post'> <input type='text' name='espece' value='$vResult[1]' hidden/> <input type='submit' value='Statistiques générales'> </form> </td>";
echo '</tr>'; echo '</tr>';
} }
......
<html>
<head>
<title>Clinique Vétérinaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Ajout d'un Traitement</h1>
<?php
// Connexion à la base de données
include("connexion.php");
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
?>
<div>
<form action="addTraitement.php" method="post">
<p>Animal:
<select name="animal" required/>
<?php
$vSql ='select idAnimal from Animal;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p>ID Vétérinaire:
<select name="veterinaire" required/>
<?php
$vSql ='select idVeterinaire from Veterinaire;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p>Médicament:
<select name="medicament" required/>
<?php
$vSql ='select nomMolec from Medicament;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p>Date de debut: <input type="date" name="ddebut" required/></p>
<p>Durée: <input type="number" name="duree" required/></p>
<p>Quantité par jour: <input type="number" name="qteJour" required/></p>
<p><input type="submit" value="OK"></p>
</form>
</div>
</body>
</html>
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<option value="animaux">Animaux</option> <option value="animaux">Animaux</option>
<option value="medicaments">Medicaments</option> <option value="medicaments">Medicaments</option>
<option value="traitements">Traitements</option> <option value="traitements">Traitements</option>
<option value="posologie">Posologies</option>
</select> </select>
<input type="submit" /> <input type="submit" />
</p> </p>
...@@ -39,38 +40,5 @@ ...@@ -39,38 +40,5 @@
</p> </p>
</form> </form>
</div> </div>
<?php
// Connexion à la base de données
$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p042';
$vUser = 'bdd0p042';
$vPass = 'cyLu9JFl';
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
// Affichage du tableau de données
// $vSql ='';
// $vSt = $vConn->prepare($vSql);
// $vSt->execute();
// while ($vResult = $vSt->fetch(PDO::FETCH_ASSOC)) {
// echo '<tr>';
// echo "<td>$vResult[]</td>";
// echo "<td>$vResult[]</td>";
// echo "<td>$vResult[]</td>";
// echo '</tr>';
// }
?>
<?php
// $vSql ='';
// $vSt = $vConn->prepare($vSql);
// $vSt->execute();
// $vResult = $vSt->fetch(PDO::FETCH_ASSOC);
// echo "<li>Département le plus peuplé : <b>$vResult[__________]</b></li>";
// $vSql ='______________________________________________________________';
// $vSt = $vConn->prepare($vSql);
// $vSt->execute();
// $vResult = $vSt->fetch(PDO::FETCH_ASSOC);
// echo "<li>Département le moins peuplé : <b>$vResult[__________]</b></li>";
?>
</body> </body>
</html> </html>
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
<body> <body>
<h1>Information des médicaments</h1> <h1>Information sur les médicaments</h1>
<form action='statMedicaments.php' method='post'> <input type='submit' value='Statistiques générales'> </form>
<table border="1"> <table border="1">
<tr> <tr>
<th>Nom médicament</th> <th>Nom médicament</th>
<th>Description</th> <th>Description</th>
<th>Statistique</th>
</tr> </tr>
<?php <?php
// Connexion à la base de données // Connexion à la base de données
...@@ -27,11 +29,11 @@ ...@@ -27,11 +29,11 @@
$vSt = $vConn->prepare($vSql); $vSt = $vConn->prepare($vSql);
$vSt->execute(); $vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) { while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>'; echo '<tr>';
echo "<td>$vResult[0]</td>"; echo "<td>$vResult[0]</td>";
echo "<td>$vResult[1]</td>"; echo "<td>$vResult[1]</td>";
echo "<td><form action='statMedicament.php' method='post'> <input type='text' name='nomMolec' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
echo '</tr>'; echo '</tr>';
} }
......
<html>
<head>
<title>Clinique Vétérinaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Information sur les posologie</h1>
<table border="1">
<tr>
<th>idTraitement</th>
<th>Médicament</th>
<th>Date de début</th>
<th>Durée</th>
<th>Nombre journalier</th>
</tr>
<?php
// Connexion à la base de données
include("connexion.php");
try{
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
} catch(PDOException $e){
echo "Erreur de connexion '$e'";
}
// Affichage du tableau de données
$vSql = "select * from posologie";
try{
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>';
echo "<td>$vResult[0]</td>";
echo "<td>$vResult[1]</td>";
echo "<td>$vResult[2]</td>";
echo "<td>$vResult[3]</td>";
echo "<td>$vResult[4]</td>";
echo '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
<html> <html>
<head> <head>
<title>Exercice</title> <title>Clinique Vétérinaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
</head> </head>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
$idAnimal = $_POST['idAnimal']; $idAnimal = $_POST['idAnimal'];
if($idAnimal == ""){ if($idAnimal == ""){
echo "Il faut dire quel animal"; echo "Il faut sélectionner un animal";
header('Location: http://tuxa.sme.utc/~bdd0p042/application/animaux.php'); header('Location: http://tuxa.sme.utc/~bdd0p042/application/animaux.php');
} }
?> ?>
...@@ -51,17 +51,16 @@ ...@@ -51,17 +51,16 @@
</table> </table>
<h1>Nombre des comprimés prescrit à un animal <h1>Nombre de comprimés prescrit à un animal </h1>
</h1>
<table border="1"> <table border="1">
<tr> <tr>
<th>Medicament</th> <th>Medicament</th>
<th>Somme</th> <th>Nb comprimés</th>
</tr> </tr>
<?php <?php
try{ try{
$vSql ="SELECT P.nomMolec,SUM(P.duree*P.nbJourna) FROM Posologie P $vSql ="SELECT P.nomMolec, SUM(P.duree*P.nbJourna) FROM Posologie P
JOIN Traitement T ON P.traitement=T.idTraitement WHERE JOIN Traitement T ON P.traitement=T.idTraitement WHERE
T.idAnimal='$idAnimal' group by P.nomMolec; T.idAnimal='$idAnimal' group by P.nomMolec;
"; ";
......
<html>
<head>
<title>Clinique Vétérinaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php
include("connexion.php");
try{
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
} catch(PDOException $e){
echo "Erreur de connexion '$e'";
}
$espece = $_POST['espece'];
if($espece == ""){
echo "Il faut sélectionner une espece";
header('Location: http://tuxa.sme.utc/~bdd0p042/application/especes.php');
}
?>
<h1>Poids moyen des <?php echo $espece ?></h1>
<table border="1">
<tr>
<th>Espèce</th>
<th>Poids moyen</th>
</tr>
<?php
try{
$vSql ="SELECT A.especenom, AVG(A.poids)
FROM Animal A
WHERE A.especenom = '$espece'
GROUP BY A.especenom;
";