Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Made By Samir
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link href="/TEST_PHP/TP MEDIATHEQUE/style.css" rel="stylesheet">
- <title>Retour d'un document </title>
- </head>
- <body >
- <h2>Retour d'un document </h2>
- <div class="middle">
- <form action="" method="POST">
- <!--<td>Numero du retour</td>
- <input type="text" name="retNum"> <br></br>-->
- <td>Date de sortie</td>
- <input type="text" name="retDate">
- <br></br><td>Numero d'un abonne</td>
- <input type="text" name="retAboNum">
- <br></br><td>Reference d'un document</td>
- <input type="text" name="retDocRef">
- <br></br>
- <input type="submit" value="Ajouter" name="submit"></input>
- <input type="submit" value="Effacer" name="erase"></input>
- </form>
- <br>
- <a href="../" style="color : inherit;">Retour au menu</a>
- </div>
- <?php
- $con = mysqli_connect('localhost', 'root', 'toor');
- if(!$con) {
- echo 'Not connected to database';
- }
- if(!mysqli_select_db($con, 'Mediatheque'))
- {
- echo 'Database Not selected';
- }
- //$retNum = isset($_POST['retNum']) ? $_POST['retNum'] : '';
- $retDate = isset($_POST['retDate']) ? $_POST['retDate'] : '';
- $retAboNum = isset($_POST['retAboNum']) ? $_POST['retAboNum'] : '';
- $retDocRef = isset($_POST['retDocRef']) ? $_POST['retDocRef'] : '';
- $today = date("d.m.y");
- if(isset($_POST['submit'])) {
- if((/*empty($retNum) || */empty($retDate) || empty($retAboNum) ||empty($retDocRef))) {
- echo '<b>Inserer la/les valeur(s)';
- }else{
- // $sql = "INSERT INTO RETOUR (/*retNum*/,retDate,retAboNum,retDocRef) VALUES ('$retDate' ,'$retAboNum','$retDocRef')";
- //$sql = "SELECT DATEDIFF('2012/04/05', '2020/20/20')";
- //$sql = "SELECT DATEDIFF( '$retDate','2020/05/05')";
- //SELECT sortDate, retDate, DATEDIFF(retDate ,sortie.sortDate) FROM `retour`, `sortie` WHERE 'ab1'= sortie.sortAboNum
- $sql = " SELECT sortDate, retDate, DATEDIFF(retDate ,sortie.sortDate) FROM retour, sortie WHERE '$retAboNum'= sortie.sortAboNum"
- $resultat = mysqli_query($con,$sql);
- if(!mysqli_query($con,$sql)) {
- echo '<b>Le retour n a pas etait enregistrer<b>';
- }else
- {
- echo '<b>Le retour est enregistrer !<b><br>';
- echo 'Nombre de jour de retour :';
- //print_r($resultat);
- $row = mysqli_fetch_assoc( $resultat);
- print_r($row);
- }
- }
- }
- if(isset($_POST['erase']) ){
- echo '';
- }
- echo '<br>Date du Jour : ';
- echo date($today);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement