1 2 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 38
| <?php
//connexion au serveur
$host = "localhost";
$user = "root";
$pass = "";
@mysql_connect($host, $user, $pass) or die("La connexion a échoué :".mysql_error());
//connexion à la BD
$bd = "profilapprenant";
@mysql_select_db($bd) or die ("selection impossible:".mysql_error());
//creation de variables
/*
$leNom = $_POST['leNom'];
$lePrenom = $_POST['lePrenom'];
$laDateTest = $_POST['laDateTest'];
$laDateNaissance = $_POST['laDateNaissance'];
$leNiveauBac = $_POST['leNiveauBac'];
*/
$query = "INSERT INTO individu (nomIndividu, prenomIndividu, dateTest, dateNaissance, niveauEtudeInd) VALUES (
'" . mysql_real_escape_string($_POST['leNom']) ."',
'" . mysql_real_escape_string($_POST['lePrenom']) ."',
STR_TO_DATE('" . mysql_real_escape_string($_POST['laDateTest']) ."'
, '%d/%m/%Y'),
STR_TO_DATE('" . mysql_real_escape_string($_POST['laDateNaissance']) ."'
, '%d/%m/%Y'),
'" . mysql_real_escape_string($_POST['leNiveauBac']) ."')";
$result = mysql_query($query) or die ("La requete a échoué:".mysql_error());
//$sql = "SELECT DATE_FORMAT(dateTest, \'%d %m %Y\') FROM individu";
//header("Location : secret.php");
?> |
Partager