Je suis en train d'ecrire une methode de modification. Les champs sont bien récupérer mais la modification n'est pas faite.
le code de fonction:
function modifier($nom_restaurant,$IDClient,$cordonne){
try {
$db9=new PDO('mysql:host=localhost;dbname=db_ramacaisse','root','');
$ID=$cordonne['ID'];
$societe = $cordonne['societe'];
$civilite = $cordonne['civilite'];
$nom = $cordonne['nom'];
$prenom = $cordonne['prenom'];
$adresse = $cordonne['adresse'];
$pays = $cordonne['pays'];
$ville = $cordonne['ville'];
$cp = $cordonne['codepostale'];
$tel = $cordonne['tel'];
$mobile = $cordonne['mobile'];
$fax = $cordonne['fax'];
$email = $cordonne['email'];
$observations=$cordonne['observations'];
$saisiLe=$cordonne['saisiLe'];
$encour=$cordonne['encour'];
$dateNaissance=$cordonne['dateNaissance'];
$photo=$cordonne['photo'];
$dernierPassage=$cordonne['dernierPassage'];
$numrue=$cordonne['numrue'];
$etage = $cordonne['etage'];
$porte = $cordonne['porte'];
$echeance=$cordonne['echeance'];
$estimation=$cordonne['estimation'];
$suppcl=$cordonne['suppcl'];
$dlg = $cordonne['dlg'];
$digit = $cordonne['digit'];
$clientFid=$cordonne['clientFid'];
$soldecl=$cordonne['soldecl'];
$cacl=$cordonne['cacl'];
$codebarre=$cordonne['codebarre'];
$carteMag=$cordonne['carteMag'];
$carteBl=$cordonne['carteBl'];
$cartePre=$cordonne['cartePre'];
$actif=$cordonne['actif'];
$numDis=$cordonne['numDis'];
$pourc=$cordonne['pourc'];
$interphone1 = $cordonne['interphone1'];
$code2=$cordonne['code2'];
$interphone2 = $cordonne['interphone2'];
$batiment=$cordonne['batiment'];
$identifient =$cordonne['identifient'];
$password = $cordonne['motdepasse'];
$db9->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db9->query('SET NAMES UTF8');
$qrt=$db9->prepare("update client_restaurant set Société=:societe, Civilité=:civilite, Nom=:nom, Prénom=:prenom,
Adresse=:adresse, Pays=:pays,
Ville=:ville, CodePostal =:codepostal, Téléphone =:telephone, Mobile =:mobile,
Fax =:fax, EMail =:email, Observations =:observations, SaisiLe =:saisile,
EnCoursAutorisé=:encour, DateNaissance =:datenaissance,
Photo=:photo, DernierPassage =:dernierpassage, NuméroRue =:numrue,
Etage=:etage, Porte=:porte,
EchéanceFacture=:echeance, EstimationLivraison=:estimation,
SuppClient=:suppcl, DIgiCode_1 =:dlg, DigiCode_2 =:digit, ClientFidelité =:clientfid,
SoldeClient=:soldecl,
CaClient=:cacl, CodeBarre =:codebarre, CarteMagnetique =:cartemag,
Carte_Bloque =:cartebl, CartePrepaye =:cartepre,
ActifDiscountCard=:actif,
NumDiscountCard=:numdis, PourcentRemise=:pourc, Interphone1=:inter1,
Code2=:code2, Interphone2=:inter2, Batiment=:bat,
Identifient=:identifient,MotDePasse=:password where IDClient =:ID");
$qrt->bindParam(':societe',$societe);
$qrt->bindParam(':civilite',$civilite);
$qrt->bindParam(':nom',$nom);
$qrt->bindParam(':prenom',$prenom);
$qrt->bindParam(':adresse',$adresse);
$qrt->bindParam(':pays',$pays);
$qrt->bindParam(':ville',$ville);
$qrt->bindParam(':codepostal',$cp);
$qrt->bindParam(':telephone',$tel);
$qrt->bindParam(':mobile',$mobile);
$qrt->bindParam(':fax',$fax);
$qrt->bindParam(':email',$email);
$qrt->bindParam(':observations',$observations);
$qrt->bindParam(':saisile',$saisiLe);
$qrt->bindParam(':encour',$encour);
$qrt->bindParam(':datenaissance',$dateNaissance);
$qrt->bindParam(':photo',$photo);
$qrt->bindParam(':dernierpassage',$dernierPassage);
$qrt->bindParam(':numrue',$numrue);
$qrt->bindParam(':etage',$etage);
$qrt->bindParam(':porte',$porte);
$qrt->bindParam(':echeance',$echeance);
$qrt->bindParam(':estimation',$estimation);
$qrt->bindParam(':suppcl',$suppcl);
$qrt->bindParam(':dlg',$dlg);
$qrt->bindParam(':digit',$digit);
$qrt->bindParam(':clientfid',$clientFid);
$qrt->bindParam(':soldecl',$soldecl);
$qrt->bindParam(':cacl',$cacl);
$qrt->bindParam(':codebarre',$codebarre);
$qrt->bindParam(':cartemag',$carteMag);
$qrt->bindParam(':cartebl',$carteBl);
$qrt->bindParam(':cartepre',$cartePre);
$qrt->bindParam(':actif',$actif);
$qrt->bindParam(':numdis',$numDis);
$qrt->bindParam(':pourc',$pourc);
$qrt->bindParam(':inter1',$interphone1);
$qrt->bindParam(':code2',$code2);
$qrt->bindParam(':inter2',$interphone2);
$qrt->bindParam(':bat',$batiment);
$qrt->bindParam(':identifient',$identifient);
$qrt->bindParam(':password',$password);
$qrt->bindParam(':IDClient',$ID);
$qrt->execute();
return "records UPDATED successfully";
}
catch(PDOException $e)
{
return $sql . "<br>" . $e->getMessage();
}
}
l'appel de la fonction:
if(isset($_POST['btn_up'])){
$cordonne['societe']=$_POST['societe'];
$cordonne['civilite']=$_POST['civilite'];
$cordonne['nom']=$_POST['nom'];
$cordonne['prenom']=$_POST['prenom'];
$cordonne['adresse']=$_POST['adresse'];
$cordonne['pays']=$_POST['pays'];
$cordonne['ville']=$_POST['ville'];
$cordonne['codepostale']=$_POST['cp'];
$cordonne['tel']=$_POST['tel'];
$cordonne['mobile']=$_POST['mobile'];
$cordonne['fax']=$_POST['fax'];
$cordonne['email']=$_POST['email'];
$cordonne['observations']=$_POST['observation'];
$cordonne['saisiLe']=$_POST['saisie'];
$cordonne['encour']=$_POST['encour'];
$cordonne['dateNaissance']=$_POST['datenaissance'];
$cordonne['photo']=$_POST['photo'];
$cordonne['dernierPassage']=$_POST['dernier'];
$cordonne['numrue']=$_POST['numero'];
$cordonne['etage']=$_POST['etage'];
$cordonne['porte']=$_POST['porte'];
$cordonne['echeance']=$_POST['echeance'];
$cordonne['estimation']=$_POST['estimation'];
$cordonne['suppcl']=$_POST['suppclient'];
$cordonne['dlg']=$_POST['dlg'];
$cordonne['digit']=$_POST['digit'];
$cordonne['clientFid']=$_POST['fid'];
$cordonne['soldecl']=$_POST['soldecl'];
$cordonne['cacl']=$_POST['cacl'];
$cordonne['codebarre']=$_POST['codebarre'];
$cordonne['carteMag']=$_POST['carte'];
$cordonne['carteBl']=$_POST['cartebl'];
$cordonne['cartePre']=$_POST['cartepre'];
$cordonne['actif']=$_POST['actif'];
$cordonne['numDis']=$_POST['numDis'];
$cordonne['pourc']=$_POST['pourc'];
$cordonne['interphone1']=$_POST['inter1'];
$cordonne['code2']=$_POST['code2'];
$cordonne['interphone2']=$_POST['inter2'];
$cordonne['batiment']=$_POST['batiment'];
$cordonne['identifient']= $_POST['identifient'];
$cordonne['password']=$_POST['motdepasse'];
$resp=$client->call('modifier',array('nom_restaurant'=>$_GET['nom'],'IDClient'=>$_POST['id'],'cordonne'=>$cordonne));
print_r($resp);
}else{
$result=$client->call('lister',array('Identifient'=>$_GET['id']));
//print_r($result);
// $count = count($result);
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'?action=modifier">';
echo '<table>';
//echo '<tr><td>codebarre</td><td><input type="text" name="code" value="'.$result['codebarre'].'"></td></tr>';
//echo '<tr><td>Code Postale</td><td><input type="text" name="cp" value="'.$result['codepostal'].'"></td></tr>';
echo '<tr><td><input type="hidden" name="id" value="'.$result['ID'].'"></td></tr>';
echo '<tr><td>Sociéte</td><td><input type="text" name="societe" value="'.$result['societe'].'"></td></tr>';
echo '<tr><td>Civilité</td><td><input type="text" name="civilite" value="'.$result['civilite'].'"></td></tr>';
echo '<tr><td>Nom</td><td><input type="text" name="nom" value="'.$result['nom'].'"></td></tr>';
echo '<tr><td>Prénom</td><td><input type="text" name="prenom" value="'.$result['prenom'].'"></td></tr>';
echo '<tr><td>Adresse</td><td><input type="text" name="adresse" value="'.$result['adresse'].'"></td></tr>';
echo '<tr><td>Pays</td><td><input type="text" name="pays" value="'.$result['pays'].'"></td></tr>';
echo '<tr><td>Ville</td><td><input type="text" name="ville" value="'.$result['ville'].'"></td></tr>';
echo '<tr><td>Code Postale</td><td><input type="text" name="cp" value="'.$result['codepostale'].'"></td></tr>';
echo '<tr><td>Téléphone</td><td><input type="text" name="tel" value="'.$result['tel'].'"></td></tr>';
echo '<tr><td>Mobile</td><td><input type="text" name="mobile" value="'.$result['mobile'].'"></td></tr>';
echo '<tr><td>Fax</td><td><input type="text" name="fax" value="'.$result['fax'].'"></td></tr>';
echo '<tr><td>EMail</td><td><input type="text" name="email" value="'.$result['email'].'"></td></tr>';
echo '<tr><td>Observation</td><td><input type="text" name="observation" value="'.$result['observations'].'"></td></tr>';
echo '<tr><td>Saisie Le</td><td><input type="text" name="saisie" value="'.date("Y-m-d", strtotime($result['saisiLe'])).'"></td></tr>';
echo '<tr><td>En cour Autorisé</td><td><input type="text" name="encour" value="'.$result['encour'].'"></td></tr>';
echo '<tr><td>Date Naissance</td><td><input type="text" name="datenaissance" value="'.date("Y-m-d", strtotime($result['dateNaissance'])).'"></td></tr>';
if($result['photo'] != null){
echo '<tr><td>Photo</td><td><input type="text" name="photo" value='.$result['photo'].'></td></tr>';
}else{
echo '<tr><td>Photo</td><td><input type="text" name="photo" value='."...".'></td></tr>';
}
echo '<tr><td>Dernier Passage</td><td><input type="text" name="dernier" value="'.date("Y-m-d", strtotime($result['dernierPassage'])).'"></td></tr>';
echo '<tr><td>Numero rue</td><td><input type="text" name="numero" value="'.$result['numrue'].'"></td></tr>';
echo '<tr><td>Etage</td><td><input type="text" name="etage" value="'.$result['etage'].'"></td></tr>';
echo '<tr><td>Porte</td><td><input type="text" name="porte" value="'.$result['porte'].'"></td></tr>';
echo '<tr><td>Echeance facture</td><td><input type="text" name="echeance" value="'.$result['echeance'].'"></td></tr>';
echo '<tr><td>Estimation Livraison</td><td><input type="text" name="estimation" value="'.$result['estimation'].'"/></td></tr>';
echo '<tr><td>Supp Client</td><td><input type="text" name="suppclient" value="'.$result['suppcl'].'"></td></tr>';
echo '<tr><td>DigiCode_1</td><td><input type="text" name="dlg" value='.$result['dlg'].'/></td></tr>';
echo '<tr><td>DigiCode_2</td><td><input type="text" name="digit" value="'.$result['digit'].'"/></td></tr>';
echo '<tr><td>ClientFidelité</td><td><input type="text" name="fid" value="'.$result['clientFid'].'"></td></tr>';
echo '<tr><td>SoldeClient</td><td><input type="text" name="soldecl" value="'.$result['soldecl'].'"></td></tr>';
echo '<tr><td>CaClient</td><td><input type="text" name="cacl" value="'.$result['cacl'].'"></td></tr>';
echo '<tr><td>CodeBarre</td><td><input type="text" name="codebarre" value="'.$result['codebarre'].'"></td></tr>';
echo '<tr><td>Carte Magnetique</td><td><input type="text" name="carte" value="'.$result['carteMag'].'"></td></tr>';
echo '<tr><td>Carte bloque</td><td><input type="text" name="cartebl" value="'.$result['carteBl'].'"></td></tr>';
echo '<tr><td>Carte prepaye</td><td><input type="text" name="cartepre" value="'.$result['cartePre'].'"></td></tr>';
echo '<tr><td>ActifDiscountCard</td><td><input type="text" name="actif" value="'.$result['actif'].'"></td></tr>';
echo '<tr><td>NumDiscountCard</td><td><input type="text" name="numDis" value="'.$result['numDis'].'"></td></tr>';
echo '<tr><td>PourcentRemise</td><td><input type="text" name="pourc" value="'.$result['pourc'].'"></td></tr>';
echo '<tr><td>Interphone1</td><td><input type="text" name="inter1" value="'.$result['interphone1'].'"></td></tr>';
echo '<tr><td>Code2</td><td><input type="text" name="code2" value="'.$result['code2'].'"></td></tr>';
echo '<tr><td>Interfone2</td><td><input type="text" name="inter2" value="'.$result['interphone2'].'"></td></tr>';
echo '<tr><td>Batiment</td><td><input type="text" name="batiment" value="'.$result['batiment'].'"></td></tr>';
echo '<tr><td>Identifient</td><td><input type="text" name="identifient" value="'.$result['identifient'].'"></td></tr>';
echo '<tr><td>MotDePasse</td><td><input type="text" name="motdepasse" value="'.$result['motdepasse'].'"></td></tr>';
echo '<tr<td><input type="submit" name="btn_up" value="valider modification"></td></tr>';
echo '</table';
echo '</form>';
Merci