Commit 088a7427 authored by Gaetan Carabetta's avatar Gaetan Carabetta

add and update

parent 9b77dc1d
......@@ -5,16 +5,12 @@
</head>
<body>
<?php
$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p042';
$vUser = 'bdd0p042';
$vPass = 'cyLu9JFl';
include("connexion.php");
try{
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
} catch(PDOException $e){
echo "Erreur de connection '$e'";
echo "Erreur de connexion '$e'";
}
try{
......@@ -35,7 +31,7 @@
$vSt = $vConn->prepare($vSql);
$vSt->execute();
header('Location: http://tuxa.sme.utc/~bdd0p042/application/animal.php');
header('Location: http://tuxa.sme.utc/~bdd0p042/application/animaux.php');
}else
echo "Il faut donner une espece";
}else
......
<p> Test </p>
<?php
<p> <?php echo $_POST['affiche']; ?> </p>
if ($_POST['affiche'] == "all"){
include("clients.php");
include("veterinaires.php");
include("assistants.php");
include("classes.php");
include("especes.php");
include("animaux.php");
include("medicaments.php");
include("traitements.php");
} elseif ($_POST['affiche'] == "clients") {
include("clients.php");
} elseif ($_POST['affiche'] == "veterinaires") {
include("veterinaires.php");
} elseif ($_POST['affiche'] == "assistants") {
include("assistants.php");
} elseif ($_POST['affiche'] == "classes") {
include("classes.php");
} elseif ($_POST['affiche'] == "especes") {
include("especes.php");
} elseif ($_POST['affiche'] == "animaux") {
include("animaux.php");
} elseif ($_POST['affiche'] == "medicaments") {
include("medicaments.php");
} elseif ($_POST['affiche'] == "traitements") {
include("traitements.php");
}
?>
<?php
if ($_POST['ajoute'] == "clients"){
include("ajoutClient.php");
include("formulaireClient.php");
} elseif ($_POST['ajoute'] == "animaux"){
include("ajoutAnimal.php");
include("formulaireAnimal.php");
} elseif ($_POST['ajoute'] == "traitements"){
include("ajoutTraitement.php");
include("formulaireTraitement.php");
} else {
include("error.php");
}
......
<html>
<head>
<title>Exercice</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 des animaux</h1>
<?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);
?>
<div>
<form action="addAnimal.php" method="post">
<p>Nom de l'animal: <input type="text" name="nom" required/></p>
<p>Poids: <input type="text" name="poids" required/></p>
<p>Taille: <input type="text" name="taille" required/></p>
<p>Date de naissance: <input type="date" name="ddn" required/></p>
<p>Client:
<select name="client" required/>
<?php
$vSql ='select idClient from Client;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p>Espece:
<select name="espece" required/>
<?php
$vSql ='select nomEspece from Espece;';
$vSt = $vConn->prepare($vSql);
$vSt->execute();
while ($vResult = $vSt->fetch(PDO::FETCH_BOTH)) {
echo "<option>$vResult[0]</option>";
}
?>
</select>
</p>
<p><input type="submit" value="OK"></p>
</form>
</div>
</body>
</html>
......@@ -20,24 +20,15 @@
</tr>
<?php
// Connexion à la base de données
$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p042';
$vUser = 'bdd0p042';
$vPass = 'cyLu9JFl';
include("connexion.php");
try{
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
} catch(PDOException $e){
echo "Erreur de connection '$e'";
echo "Erreur de connexion '$e'";
}
// Affichage du tableau de données
if ($_POST['affiche'] == "animaux")
$vSql ='select * from Animal;';
include("animal.php");
try{
$vSt = $vConn->prepare($vSql);
$vSt->execute();
......
<html>
<head>
<title>Exercice</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 des animaux</h1>
<table border="1">
<tr>
<th>idAnimal</th>
<th>Nom</th>
<th>Poids</th>
<th>Taille</th>
<th>Naissance</th>
<th>idClient</th>
<th>Espece</th>
<th>Statistiques</th>
<th>Supprimer</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
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 "<td>$vResult[5]</td>";
echo "<td>$vResult[6]</td>";
echo "<td><form action='statAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
echo "<td><form action='remAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input id='btnRemove' type='submit' value='X'> </form></td>";
echo '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
<html>
<head>
<title>Exercice</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 des animaux</h1>
<table border="1">
<tr>
<th>idAnimal</th>
<th>Nom</th>
<th>Poids</th>
<th>Taille</th>
<th>Naissance</th>
<th>idClient</th>
<th>Espece</th>
<th>Statistiques</th>
<th>Supprimer</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
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 "<td>$vResult[5]</td>";
echo "<td>$vResult[6]</td>";
echo "<td><form action='statAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
echo "<td><form action='remAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input id='btnRemove' type='submit' value='X'> </form></td>";
echo '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
<p> Choix non supporté, veuillez retourner à l'index </p>
<?php header("Location : http://tuxa.sme.utc/~bdd0p042/application/index.php"); ?>
<html>
<head>
<title>Exercice</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 des animaux</h1>
<table border="1">
<tr>
<th>idAnimal</th>
<th>Nom</th>
<th>Poids</th>
<th>Taille</th>
<th>Naissance</th>
<th>idClient</th>
<th>Espece</th>
<th>Statistiques</th>
<th>Supprimer</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
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 "<td>$vResult[5]</td>";
echo "<td>$vResult[6]</td>";
echo "<td><form action='statAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
echo "<td><form action='remAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input id='btnRemove' type='submit' value='X'> </form></td>";
echo '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
......@@ -8,11 +8,7 @@
<h1>Information des animaux</h1>
<?php
// Connexion à la base de données
$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p117';
$vUser = 'bdd0p117';
$vPass = 'LpIHl1sZ';
include("connexion.php");
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
?>
<div>
......
<html>
<head>
<title>Exercice</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 des animaux</h1>
<table border="1">
<tr>
<th>idAnimal</th>
<th>Nom</th>
<th>Poids</th>
<th>Taille</th>
<th>Naissance</th>
<th>idClient</th>
<th>Espece</th>
<th>Statistiques</th>
<th>Supprimer</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
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 "<td>$vResult[5]</td>";
echo "<td>$vResult[6]</td>";
echo "<td><form action='statAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
echo "<td><form action='remAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input id='btnRemove' type='submit' value='X'> </form></td>";
echo '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
......@@ -5,11 +5,6 @@
</head>
<body>
<?php
/*$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p117';
$vUser = 'bdd0p117';
$vPass = 'LpIHl1sZ';*/
include("connexion.php");
try{
......
......@@ -6,23 +6,17 @@
</head>
<body>
<?php
/*$vHost = 'tuxa.sme.utc';
$vPort = '5432';
$vData = 'dbbdd0p117';
$vUser = 'bdd0p117';
$vPass = 'LpIHl1sZ';
*/
include("connexion.php");
try{
$vConn = new PDO("pgsql:host=$vHost;port=$vPort;dbname=$vData", $vUser, $vPass);
} catch(PDOException $e){
echo "Erreur de connection '$e'";
echo "Erreur de connexion '$e'";
}
$idAnimal = $_POST['idAnimal'];
if($idAnimal == ""){
echo "Il faut dire quel animal";
header('Location: http://tuxa.sme.utc/~bdd0p042/application/animal.php');
header('Location: http://tuxa.sme.utc/~bdd0p042/application/animaux.php');
}
?>
......
<html>
<head>
<title>Exercice</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 des animaux</h1>
<table border="1">
<tr>
<th>idAnimal</th>
<th>Nom</th>
<th>Poids</th>
<th>Taille</th>
<th>Naissance</th>
<th>idClient</th>
<th>Espece</th>
<th>Statistiques</th>
<th>Supprimer</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
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 "<td>$vResult[5]</td>";
echo "<td>$vResult[6]</td>";
echo "<td><form action='statAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
echo "<td><form action='remAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input id='btnRemove' type='submit' value='X'> </form></td>";
echo '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
<html>
<head>
<title>Exercice</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 des animaux</h1>
<table border="1">
<tr>
<th>idAnimal</th>
<th>Nom</th>
<th>Poids</th>
<th>Taille</th>
<th>Naissance</th>
<th>idClient</th>
<th>Espece</th>
<th>Statistiques</th>
<th>Supprimer</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
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 "<td>$vResult[5]</td>";
echo "<td>$vResult[6]</td>";
echo "<td><form action='statAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input type='submit' value='Statistiques'> </form></td>";
echo "<td><form action='remAnimal.php' method='post'> <input type='text' name='idAnimal' value=$vResult[0] hidden/> <input id='btnRemove' type='submit' value='X'> </form></td>";
echo '</tr>';
}
} catch(PDOException $e){
echo "Erreur de requete '$e'";
}
?>
</table>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment