Modifier des informaions de la base

Signaler
Messages postés
2
Date d'inscription
vendredi 23 juillet 2021
Statut
Membre
Dernière intervention
23 juillet 2021
-
bonjour j'aimerais pouvoir faire modifier une entrer par l'utilisateur du genre si mal écrit
le non d'un élève il puisse la rectifier voici mon code
<?php try
		{
			$bdd = new PDO('mysql:host=localhost;dbname=corias','root','');
		}
		catch(Exception $e)
		{

			die('Erreur : '.$e->getMessage());
		}
			$crs = $bdd->query('SELECT COUNT(*) AS nb_eleve FROM corias2021');
			$re = $bdd->query("SET NAMES UTF8");
			$reponse = $bdd->query('SET lc_time_names = \'fr_FR\'');
			$reponse->closeCursor();
			if (isset($_GET['page']) && !empty($_GET['page'])) 
			{
				$currentpage = (int) strip_tags($_GET['page']);
			}
			else
			{
				$currentpage = 1;
			}
			$result = $crs->fetch();
			$nbeleve = (int) $result['nb_eleve'];
			$parPage = 5;
			$pages = ceil($nbeleve / $parPage);
			$premier = ($currentpage * $parPage) - $parPage;
			$sql = $bdd->prepare('SELECT * FROM corias2021 LIMIT :premier,:parpage ');
			$sql->bindValue(':premier', $premier, PDO::PARAM_INT);
			$sql->bindValue(':parpage', $parPage, PDO::PARAM_INT);
			$sql->execute();
			$articles = $sql->fetchAll(PDO::FETCH_ASSOC);			
?>
	<style type="text/css">
		@font-face
{
  font-family: 'BebasNeue';
	src: url('police/BebasNeue-Regular.ttf');
}
.nav-links
{
	justify-content: flex-start;
}
#rubrique
{ 
  display: flex;
  justify-content: space-around; 
	background-color: #00b9ff ;
}
.min-rubrique
{ 
  background: rgba(90, 109, 147, 1);
  display: inline-block;
  width: 31.8%;
  border-right: 1px solid;
}
.tab
  {
    background: rgba(0, 0, 0, 0.1);
    padding-right: 46%;
    color: #ffff;
    border: 2px groove blue;
  }
  .cla
  {
    padding-right: 1%;
  }
  .nom
  {
    padding-right: 1%;
  }
  #chasser 
  {
    display: none;
  }
  
.tab
{
	position: relative;
}
#rubrique img
{
	width: 35px;
	height: 35px;
	z-index: 1;
	padding-left: 25px;
}
.img
{
  	text-align: center;
  	position: absolute;
  	right: 3%;
  	top: 5px;
  	width: 20px;
  	height: 20px;
  	color: black;
  	display: inline-block;
}
 table td
{
 	 padding-right: 1%;
}
table
{
	border-collapse : collapse;
	padding-top: 10px;
}
th
{
	border: 2px groove blue;
	font-size: 0.9em;
	text-align: center;
}
td
{
	text-align: center;
	border: 2px solid blue;
}
nav {
  height: 10vh;
  background: #5b78c7;
}
 table thead
  {
    display: none;
  }
  table
  {
    width: 100%;
    box-shadow: -5px 0px 3px #6d6e6a;
  }
  table tr
  {
    display: block;
    margin-bottom: 8px;
  }
  table td
  {

    font-size: 1.4em;
    display: block;
    font-family: BebasNeue;
    text-align: right;
  }
  table td::before
  {
    content: attr(data-label);
    float: left;
    font-weight: bold;
    color: #005b7e;
  }
  .arr, .tel, .mnt
  {
  	display: none;
  }
 #loupe
 {
 	z-index: 1;
 	box-shadow: 2px 2px 2px #e1e2dc;
 	border-radius: 5px;
 	padding: 5px;
 	width: 20px;
 	height: 20px;
 	background-color: blue;
 	position: absolute;
 	top: 30px;
 	right: 10%;
 	transition-property: all;
 	transition-duration: 1s;
 }
 #loupe:hover
 {
 	position: absolute;
 	top: 31px;
 	right: 9.9%;
 }
 #rechercher
 {
 	z-index: 1;
 	border: 3px solid #e1e2dc ;
 	border-radius: 5px 0 0 5px;
 	position: absolute;
 	left: -5%;
 	top: 5px;
 	margin: 30px;
 	height: 27px;
 	width: 80%;
 }
.nav-links li 
{
	margin-top: 20px;
	font-family: 'Righteous-Regular';
	position: relative;
	top: 55px;
	right: 10.5%;
}
.nav-links li:hover
{
	position: relative;
	top:58px;
	right: 10%;
}
.nav-links li a
{	
	color: black;
	position: relative;
	top: -8px;
	right: -5px;
	display: inline-block;
	font-weight: bold;
	font-size: 2em;
}
li img
{
	box-shadow: 1px 2px 2px #e1e2dc;
	padding: 5px;
	border-radius: 5px;
	background-color: blue;
	width: 30px;
	height:30px;
	border: 1px solid #e1e2dc ;
}
	</style>
<DOCTYPE html>
<html>
<head>
	<link rel="stylesheet" type="" href="accs.css">
	<meta charset="utf-8">
	<title>accueil</title>
	<meta name="viewport" content="width=device-width"/>
   </head>
<body>
	<header >	
		<span id="corias">
			CORIAS
		</span>
<nav>
      <div class="hamburger">
        <div class="line"></div>
        <div class="line"></div>
        <div class="line"></div>
      </div>
      <ul class="nav-links" >
    <form id="content" action="resultats.php" method="get"  >
  <input type="search" name="terme" placeholder="Rechercher..." id="rechercher">
  <input type="image" name="s" src="img\loupe.png" id="loupe">
	</form>
        <li><img src="img\003-plus-2.png"><a href="inscription.php">Inscrire</a></li>
        <li><img src="img\deconnexion.png"><a href="#">Modifier</a></li>
        <li><img src="img\delete.png"><a href="#">Supprimer</a></li>
      </ul>
    </nav>
   <script src="app.js"></script>
	</header>
	<header id="rubrique" style="height: 35px" >
<div class="min-rubrique" id="b1" >
	<a href="#"><img src="img\maison(2).png" id="maison"  ></a>			
</div>
<div class="min-rubrique" onclick="alert('bonjour')"  >
	<a href="#"><img src="img\007-warning-sign.png" id="aver"></a>			
</div>
<div class="min-rubrique">
	<a href="#"><img src="img\interdit.png" id="insolvable"></a>
</div>
	</header>
	<?php 
	/*
	if( isset($_POST['identifiant']) AND $_POST['identifiant'] =="corias" AND isset($_POST['mot_de_passe']) AND $_POST['mot_de_passe']=="corias2021")
		{// On affiche les codes
*/			
			//ajout de nouvelle eleves
			$req = $bdd->prepare('INSERT INTO corias2021 (nom_eleve, classe_eleve, montant, numero_parent, date_darriver, date_proch_payement) VALUES ( :nom, :classe, :montant, :tel, :date_darriver, DATE_ADD(date_darriver, INTERVAL 2 DAY))');
			if (isset($_POST['nom']) AND isset($_POST['classe']) AND  isset($_POST['montant']) AND isset($_POST['telephone']) AND isset($_POST['date']))
			{
				$nom = $_POST['nom'];
				$classe = $_PPOST['classe'];
				$montant = $_POST['montant'];
				$telephone = $_POST['telephone'];
				$date_darriver =$_POST['date'];
		$req->execute(array(
			'nom' => $nom,
			'classe' => $classe,
			'montant' => $montant,
			'tel' => $telephone,
			'date_darriver' => $date_darriver));
		}
		?>
		<?php $i=1; 
$reponse = $bdd->query('SELECT UPPER(nom_eleve) AS nom_maj, classe_eleve, DATE_FORMAT(date_proch_payement, \'%a %d %b %Y\') AS jolie_date_proch, DATE_FORMAT(date_darriver, \'%a %d %b %Y\') AS date_venue ,numero_parent, montant FROM corias2021  ORDER BY id') or die(print_r($bdd->errorInfo())) ; 
				echo '<div id="accueil" >';
				while($donnees=$reponse->fetch())
				{
		echo '<table>
				<thead>';
		echo	'<tr>';
		echo		'<th>ID</th>';
		echo		'<th>Nom</th>';
		echo		'<th>Classe</th>';
		echo		'<th>Arriver le</th>';
		echo	'</tr>
				</thead>';
		echo	"<tbody>";
		echo	 '<tr>';
		echo		'<td data-label="ID:" class="tab">'. $i ?><img src="img\002-plus-1.png" onclick="aff('arr', 'pay');" class="img"><?php '</td>';
		echo		 '<td data-label="Nom:" class="nom" >'. $donnees['nom_maj'] .'</td>';
		echo		 '<td data-label="Classe:" class="cla" >'. $donnees['classe_eleve'] .'</td>';
		echo		 '<td data-label="Payera le:" class="pay" >'. $donnees['jolie_date_proch'].'</td>';
		echo 					'<div id="plus_dinfo" >';
		echo		 '<td data-label="Arriver le:" class="arr" >'. $donnees['date_venue'].'</td>';
		echo		 '<td data-label="tel parent:" class="tel" >'. $donnees['numero_parent'].'</td>';
		echo		 '<td data-label="montant a payer:" class="mnt" >'. $donnees['montant'].'fcfa</td>';
		echo 					"</div>";
		echo	 '</tr>';
		echo 	 "</tbody>";
		echo '</table>';
				}	
				?>
			</div>
			<?php 
			$insolvable =  $bdd->query('SELECT UPPER(nom_eleve) AS nom_maj, classe_eleve, DATE_FORMAT(date_proch_payement, \'%a %d %b %Y\') AS jolie_date_proch, DATE_FORMAT(date_darriver, \'%a %d %b %Y\') AS date_venue ,numero_parent, montant FROM corias2021  ORDER BY id') or die(print_r($bdd->errorInfo())) ;
				echo '<div id="chasser">';
				while ($donnees = $insolvable->fetch())
				{
				?>
		    <table>
			<thead>
			    <tr>
			    <th>ID</th>
				<th>Nom</th>
				<th>Classe</th>
				<th>Arriver le</th>
			    </tr>
			 </thead>
		   <tbody>
			 <tr> 
					  <td data-label="ID:" class="tab"><?php  echo $i ?><img src="img\002-plus-1.png" onclick="aff('arr', 'pay');" class="img"></td><?php
		echo		 '<td data-label="Nom:" class="nom" >'. $donnees['nom_maj'] .'</td>';
		echo		 '<td data-label="Classe:" class="cla" >'. $donnees['classe_eleve'] .'</td>';
		echo		 '<td data-label="Payera le:" class="dte" >'. $donnees['jolie_date_proch'].'</td>';
		echo		 '<td data-label="Arriver le:" class="arr" >'. $donnees['date_venue'].'</td>';
		echo		 '<td data-label="tel parent:" class="tel" >'. $donnees['numero_parent'].'</td>';
		echo		 '<td data-label="montant a payer:" class="mnt" >'. $donnees['montant'].'fcfa</td>';
		echo	 '</tr>';
		echo 	 "</tbody>";
		echo '</table>';
				}?><!--
				<nav>
					<ul class="pagination" >
						<li class="page-item <?= ($currentpage == 1) ? "disabled" : "" ?>">
							<a href="./?page=<?= $currentpage - 1 ?>" class="page-link" >precedent</a>
						</li>
						<?php for ($page=1; $page <=$pages ; $page++): ?> 
							<li class="page-item <?= ($currentpage == $page) ? "active" : "" ?>">
								<a href="./?page=<?= $page ?>" class="page-link"><?= $page ?></a>
							</li>
						<?php endfor ?>
						<li class="page-item <?= ($currentpage == $pages) ? "disabled":""?>">
							<a href="./?page=<?= $currentpage + 1 ?>" class="page-link">suivante</a>
						</li>
					</ul>
				</nav>-->
				<?php /*
			$advert =  $bdd->query('SELECT UPPER(nom_eleve) AS nom_maj, classe_eleve,  DATE_FORMAT(date_proch_payement, \'%a %d %b %Y\') AS jolie_date_proch FROM corias2021 WHERE classe_eleve = \'6ieme\'') or die(print_r($bdd->errorInfo()));
				echo '<div id="advert">';
				while ($ad = $advert->fetch())
				{
				?>
		    <table>
			<thead>
			    <tr>
			    <th>ID</th>
				<th>Nom</th>
				<th>Classe</th>
				<th>Arriver le</th>
			    </tr>
			 </thead>
		   <tbody>
			 <tr> 
					  <td data-label="ID:" class="tab"><?php  echo $i ?><img src="img\002-plus-1.png" onclick="aff('arr', 'pay');" class="img"></td><?php
		echo		 '<td data-label="Nom:" class="nom" >'. $ad['nom_maj'] .'</td>';
		echo		 '<td data-label="Classe:" class="cla" >'. $ad['classe_eleve'] .'</td>';
		echo		 '<td data-label="Payera le:" class="dte" >'. $ad['jolie_date_proch'].'</td>';
		echo		 '<td data-label="Arriver le:" class="arr" >'. $ad['date_venue'].'</td>';
		echo		 '<td data-label="tel parent:" class="tel" >'. $ad['numero_parent'].'</td>';
		echo		 '<td data-label="montant a payer:" class="mnt" >'. $ad['montant'].'fcfa</td>';
		echo	 '</tr>';
		echo 	 "</tbody>";
		echo '</table>';
				}?>
			<?php /*
		} 
		else
		{	
		 echo '<p>informations incorectes</p>'; 
		}
		*/?>
		<script type="text/javascript">
const hamburger = document.querySelector(".hamburger");
const navLinks = document.querySelector(".nav-links");
const links = document.querySelectorAll(".nav-links li");

hamburger.addEventListener("click", () => {navLinks.classList.toggle("open");
	links.forEach(link => {
		link.classList.toggle("fade");
	});});
		</script>

</body>
</html>