| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 
 | <?php 
 
$host="sql.free.fr";
$base="frevale";
$passe="motdepasse";
 
  //on se connecte à MySQL
 
mysql_connect($host,$base,$passe);  
 
 // on seléctionne la base 
 
mysql_selectdb("Test");
 
if(isset($_GET['Nom'])) $Nom=$_GET['Nom']; else $Nom="Vide";
if(isset($_GET['Prenom'])) $Prenom=$_GET['Prenom']; else $Prenom="Vide";
 
 
// insertion
 
mysql_query ("INSERT INTO Test VALUES  (Now(),'$Nom','$Prenom')");
 
 
// relecture derniere entrée
 
$reponse = mysql_query("INSERT INTO Test VALUES (Null,Now(),'$Nom','$Prenom')") or die("'Erreur SQL !'");
 
//$reponse = mysql_query ("SELECT * FROM Test ORDER BY id DESC LIMIT 1"); // Requête SQL  
 
 while ($donnees = mysql_fetch_array($reponse)) // On boucle pour afficher toutes les données
 {
 echo "**|".$donnees['Nom']."|".$donnees['Prenom']."|**";
 }
 
// on ferme la connexion à mysql
mysql_close();
 ?> | 
Partager