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');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('chat','mammifere');
INSERT INTO espece (nomEspece,nomClasse) VALUES ('lapin','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 ('dragon','autres');
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
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 ('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');
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 ('lapin','ISIMIG');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souri','KARDEGIC');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souri','LEVOTHYROX');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('souris','KARDEGIC');
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','KARDEGIC');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('chien','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 ('chat','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 ('chat','TAHOR');
INSERT INTO espece_med (nomEspece,nomMolec) VALUES ('lapin','DOLIPRANE');
......
......@@ -2,58 +2,58 @@
<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);
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>
</html>
......@@ -9,6 +9,7 @@ if ($_POST['affiche'] == "all"){
include("animaux.php");
include("medicaments.php");
include("traitements.php");
include("posologie.php");
} elseif ($_POST['affiche'] == "clients") {
include("clients.php");
} elseif ($_POST['affiche'] == "veterinaires") {
......@@ -25,6 +26,8 @@ if ($_POST['affiche'] == "all"){
include("medicaments.php");
} elseif ($_POST['affiche'] == "traitements") {
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 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Information des animaux</h1>
<h1>Information sur les animaux</h1>
<table border="1">
<tr>
<th>idAnimal</th>
......@@ -33,7 +33,6 @@
try{
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>';
......
......@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Information des assitants</h1>
<h1>Information sur les assitants</h1>
<table border="1">
<tr>
<th>idAssistant</th>
......@@ -32,7 +32,6 @@
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>';
echo "<td>$vResult[0]</td>";
......
......@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Information des classes</h1>
<h1>Information sur les classes</h1>
<table border="1">
<tr>
<th>Nom Classe</th>
......@@ -25,7 +25,6 @@
try{
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>';
......
......@@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Information des clients</h1>
<h1>Information sur les clients</h1>
<table border="1">
<tr>
<th>idClient</th>
......@@ -31,7 +31,6 @@
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>';
echo "<td>$vResult[0]</td>";
......
<?php
$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p042';
$vUser = 'bdd0p042';
$vPass = 'cyLu9JFl';
$vData = 'dbbdd0p000';
$vUser = 'bdd0p000';
$vPass = '';
?>
......@@ -5,11 +5,13 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<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">
<tr>
<th>Classe</th>
<th>Espece</th>
<th>Statistique</th>
</tr>
<?php
// Connexion à la base de données
......@@ -27,11 +29,11 @@
$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><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>';
}
......
<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 @@
<option value="animaux">Animaux</option>
<option value="medicaments">Medicaments</option>
<option value="traitements">Traitements</option>
<option value="posologie">Posologies</option>
</select>
<input type="submit" />
</p>
......@@ -39,38 +40,5 @@
</p>
</form>
</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>
</html>
......@@ -5,11 +5,13 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<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">
<tr>
<th>Nom médicament</th>
<th>Description</th>
<th>Statistique</th>
</tr>
<?php
// Connexion à la base de données
......@@ -27,11 +29,11 @@
$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><form action='statMedicament.php' method='post'> <input type='text' name='nomMolec' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
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>
<head>
<title>Exercice</title>
<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>
......@@ -15,7 +15,7 @@
$idAnimal = $_POST['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');
}
?>
......@@ -51,17 +51,16 @@
</table>
<h1>Nombre des comprimés prescrit à un animal
</h1>
<h1>Nombre de comprimés prescrit à un animal </h1>
<table border="1">
<tr>
<th>Medicament</th>
<th>Somme</th>
<th>Nb comprimés</th>
</tr>
<?php
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
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;
";
$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 '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
<h1>Taille moyenne des <?php echo $espece ?></h1>
<table border="1">
<tr>
<th>Espèce</th>
<th>Taille moyenne</th>
</tr>
<?php
try{
$vSql ="SELECT A.especenom, AVG(A.taille)
FROM Animal A
WHERE A.especenom = $espece
GROUP BY A.especenom;
";
$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 '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
<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'";
}
?>
<h1>Information sur les espèces</h1>
<table border="1">
<tr>
<th>Espèce</th>
<th>Poids moyen</th>
<th>Taille moyenne</th>
</tr>
<?php
try{
$vSql ="SELECT A.especenom, AVG(A.poids), AVG(A.taille)
FROM Animal A
GROUP BY A.especenom;
";
$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 '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
<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'";
}
$nomMolec = $_POST['nomMolec'];
if($nomMolec == ""){
echo "Il faut sélectionner un medicament";
header('Location: http://tuxa.sme.utc/~bdd0p042/application/medicament.php');
}
?>
<h1>Quantité de <?php echo $nomMolec ?> prescrit</h1>
<table border="1">
<tr>
<th>Medicament</th>
<th>Quantité</th>
</tr>
<?php
try{
$vSql ="SELECT P.nomMolec as medicament, COUNT(*)
FROM Posologie P
WHERE P.nomMolec='$nomMolec'
GROUP BY P.nomMolec;
";
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo '<tr>';