parse error: syntax error, unexpected end of file in c:\wamp\www\form\biodata.php="" on="" line="" 115
1 <?php 2 // connexion à la base de données 3 $db_username = 'root'; 4 $db_password = ''; 5 $db_name = 'licence'; 6 $db_host = 'localhost'; 7 $cnx = mysqli_connect($db_host, $db_username, $db_password, $db_name) or die('could not connect to database'); 8 9 if($cnx == false){ 10 die("ERREUR : Impossible de se connecter. " . mysqli_connect_error()); 11 } 12 // récupérertous les utilisateur 13 ?> 14 15 <!DOCTYPE html> 16 <html lang="fr"> 17 <head> 18 <meta charset="utf-8"> 19 <title>Mini Blog</title> 20 <link rel="stylesheet" type="text/css" href="../css/styles.css"> 21 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 22 </head> 23 <body> 24 <?php 25 $cnx = "mysql:host=$db_host;dbname=$db_name"; 26 $sql = "SELECT * FROM etudiants"; 27 28 try{ 29 $pdo = new PDO($cnx, $db_username, $db_password); 30 $stmt = $pdo->query($sql); 31 32 if($stmt === false){ 33 die("Erreur"); 34 } 35 36 }catch (PDOException $e){ 37 echo $e->getMessage(); 38 } 39 while($row = $stmt->fetch(PDO::FETCH_ASSOC)) : 40 ?> 41 42 43 <?php 44 45 //connection au serveur 46 // $cnx = @mysql_connect( "localhost", "root", "" ) ; 47 48 //sélection de la base de données: 49 // $db = mysql_select_db( "licence" ) ; 50 51 //récupération des valeurs des champs: 52 $id = $_POST["id"] ; 53 //nom: 54 $nom = $_POST["nom"] ; 55 //prenom: 56 $prenom = $_POST["prenom"] ; 57 //adresse: 58 $adresse = $_POST["adresse"] ; 59 //code postal: 60 $mail = $_POST["mail"] ; 61 //numéro de téléphone: 62 $tel = $_POST["telephone"] ; 63 64 //création de la requête SQL: 65 // $sql = "INSERT INTO etudiants (nom, prenom, adresse, mail, telephone) 66 // VALUES ( '$nom', '$prenom', '$adresse', '$mail', '$tel') " ; 67 68 //exécution de la requête SQL: 69 $requete = mysql_query($sql, $cnx) or die( mysql_error() ) ; 70 71 //affichage des résultats, pour savoir si l'insertion a marchée: 72 if($requete) 73 74 { 75 76 $message = 'Etudiant enregistré dans la BD'; 77 78 } 79 80 else { 81 82 $message = 'Echec d ajout '; 83 84 } 85 86 ?> 87 <table> 88 <tbody> 89 <thead> 90 <tr> 91 92 <th>nom</th> 93 <th>prenom</th> 94 <th>adresse</th> 95 <th>mail</th> 96 <th>tel</th> 97 </tr> 98 </thead> 99 100 <tr> 101 <td><?php echo $article['id'];?></td> 102 <td><?php echo $article['nom'];?></td> 103 <td><?php echo $article['prenom'];?></td> 104 <td><?php echo $article['adresse'];?></td> 105 <td><?php echo $article['mail'];?></td> 106 <td><?php echo $article['telephone'];?></td> 107 108 109 </tr> 110 111 </tbody> 112 </table> 113 114 </body> 115 </html>
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) :
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)