PDO, INSERT et bindParam()

Résolu
Elsyfiryos Messages postés 83 Date d'inscription   Statut Membre Dernière intervention   -  
Elsyfiryos Messages postés 83 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Voila j'ai un problème avec ceci:

	$time = time(); 
	$name = htmlspecialchars($_POST['name']) ;
	$first_name = htmlspecialchars($_POST['first_name']) ;
	$address = htmlspecialchars($_POST['address']) ;
	$postal_code = htmlspecialchars($_POST['postal_code']) ;
	$town = htmlspecialchars($_POST['town']) ;
	$country = htmlspecialchars($_POST['country']) ;
	$phone = htmlspecialchars($_POST['phone']) ;
	$mail = htmlspecialchars($_POST['mail']) ;
	$password = md5($_POST['password']);
	$confirm_password = md5($_POST['confirm_password']);
        
        $statement = $bdd->prepare("INSERT INTO client (e-mail, mdp, nom, prenom, adresse, code_postale, ville, pays, tel, date_inscription)
				   VALUES (:mail, :mdp, :nom, :prenom, :adresse, :code, :ville, :pays, :tel, :date)");
        $statement->bindParam(':mail', $mail, PDO::PARAM_STR);
        $statement->bindParam(':mdp', $password, PDO::PARAM_STR);
        $statement->bindParam(':nom', $name, PDO::PARAM_STR);
        $statement->bindParam(':prenom', $first_name, PDO::PARAM_STR);
        $statement->bindParam(':adresse', $address, PDO::PARAM_STR);
        $statement->bindParam(':code', $postal_code, PDO::PARAM_INT);
        $statement->bindParam(':ville', $town, PDO::PARAM_STR);
        $statement->bindParam(':pays', $country, PDO::PARAM_STR);
        $statement->bindParam(':tel', $phone, PDO::PARAM_INT);
        $statement->bindParam(':date', $time, PDO::PARAM_INT);
	$statement->execute();


Aucune erreur n'est affichée mais rien est inscrit dans ma bdd (j'ai précédemment mis les identifiants de mysql, ils sont correct).
Pourriez vous m'aidez ?
Merci d'avance.

A voir également:

1 réponse

Elsyfiryos Messages postés 83 Date d'inscription   Statut Membre Dernière intervention   11
 
C'est bon j'ai résolu
Désolé du dérangement.

	    $statement = $bdd->prepare("INSERT INTO client (mail, mdp, nom, prenom, adresse, cp, ville, pays, tel, date)
				       VALUES (:mail, :mdp, :nom, :prenom, :adresse, :code, :ville, :pays, :tel, :date)");
	    $statement->bindParam(':mail', $mail);
	    $statement->bindParam(':mdp', $password);
	    $statement->bindParam(':nom', $name);
	    $statement->bindParam(':prenom', $first_name);
	    $statement->bindParam(':adresse', $address);
	    $statement->bindParam(':code', $postal_code);
	    $statement->bindParam(':ville', $town);
	    $statement->bindParam(':pays', $country);
	    $statement->bindParam(':tel', $phone);
	    $statement->bindParam(':date', $time);
	    $statement->execute();
	    $statement->closeCursor();


Je recherche une entreprise pour contrat d'alternance en informatique, IDF.
0
chikhimngi
 
Donnez-nous la solution si vous avez résolu
0
Elsyfiryos Messages postés 83 Date d'inscription   Statut Membre Dernière intervention   11
 
Oui, dsl.
C'était un problème avec ma BDD, j'ai supprimé la table et je l'ai refaite.
Je ne sais pas pourquoi mais rien ne pouvait y être écrit.
Voila.
0