Modifier un client

[insert_php]

try {
$bdd = new PDO(‘mysql:host=abassurcfxab.mysql.db;dbname=abassurcfxab;charset=utf8’, ‘abassurcfxab’, ‘TYm77GFPSzzg’);

} catch (PDOException $e) {

echo ‘‘;
die();
}
$id=$_GET[‘id’];

$reponse = $bdd->query(‘SELECT * FROM wp_users WHERE ID = ‘.$id);
$donnees = $reponse->fetch();
[/insert_php]
Modifier une facture








Observation :

[insert_php]
// On commence par récupérer les champs
if(isset($_POST[‘modifier’]))
{

if(isset($_POST[‘user_age’])) $user_age=$_POST[‘user_age’];
else $user_age= » »;

if(isset($_POST[‘user_adresse’])) $user_adresse=$_POST[‘user_adresse’];
else $user_adresse= » »;

if(isset($_POST[‘user_tel’])) $user_tel=$_POST[‘user_tel’];
else $user_tel= » »;

if(isset($_POST[‘user_commentaire’])) $user_commentaire=$_POST[‘user_commentaire’];
else $user_commentaire= » »;

$idCci = $_GET[‘id’];
$date=date(« Y-m-d H:i:s »);
$sql = ‘UPDATE wp_users SET user_age = :user_age, user_adresse = :user_adresse, user_tel = :user_tel , user_commentaire = :user_commentaire , date_modif_client = :date WHERE ID = ‘.$id ;

$stmt = $bdd->prepare($sql);
$stmt->bindParam(‘:user_age’, $user_age, PDO::PARAM_STR);
$stmt->bindParam(‘:user_adresse’, $user_adresse, PDO::PARAM_STR);
$stmt->bindParam(‘:user_tel’, $user_tel, PDO::PARAM_STR);
$stmt->bindParam(‘:user_commentaire’, $user_commentaire, PDO::PARAM_STR);
$stmt->bindParam(‘date’, $date, PDO::PARAM_STR);
$stmt->execute();

if($stmt)
{
echo ‘‘;
// Redirection de l’admin vers la page de consultation
header(‘Location: http://espace.ab-assur.com/consulter-la-liste-des-clients’);
exit();

}
else {
echo ‘‘;
}
}[/insert_php]