Bonjour à tous et à toutes,

Je suis actuellement sur la conception d'un espace de modification pour des œuvres précédemment publié.

Voici ou je bloque ^^ :

Lorsque je me connecte sous le membre "x" et que je souhaite allez modifier une des précédentes publication que j'ai effectué sous cette session, par exemple je souhaite modifier juste le titre et la description sans avoir changé une image ou l'avoir supprimé,

Alors, les modifications se déroulerons bien mais l'image est changer par une image vide.. ( alors que je n'ai pas toucher l'image ^^ )

Et je pense avoir compris pourquoi ^^, du faite que ma requête modifie tout..

Faut il obligatoirement créer une second requête à part spécialement pour la modification de l'image que j’insérerai dans une condition ^^ ?

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
39
40
41
42
43
44
45
46
47
48
49
50
51
if (isset($_POST['sent'])) 
{
	$titreoeuvre=$_POST['titre_oeuvre'];
 $descriptionoeuvre=$_POST['description_oeuvre'];
 $categorie=$_POST['oeuvre_categorie'];
 $style=$_POST['oeuvre_style'];
 $date_crea=$_POST['date_crea'];
	if ($_FILES['image_oeuvre']['name']!=NULL)
	{
 $imageoeuvre=$_FILES['image_oeuvre']['name'];
 $ext = strtolower(pathinfo($imageoeuvre,PATHINFO_EXTENSION));
$allow_ext = array('jpg','png','gif','bmp','jpeg');
if (!empty($imageoeuvre))
{
if (in_array($ext,$allow_ext))
{
	$destination ="./images/oeuvres/".$imageoeuvre;
move_uploaded_file($_FILES['image_oeuvre']['tmp_name'],$destination);
 
}
else
{
	echo '<p class="texteerror">'."Votre fichier contient une mauvaise extension, ou n'est pas une image.".'</p>';
}
}
	}
 
 if ( (!empty($imageoeuvre)) OR (!empty($titreoeuvre)) OR (!empty($descriptionoeuvre)) OR (!empty($categorie)) OR (!empty($style)) OR (!empty($datecreaoeuvre)) )
 
{
	try {
		$artiste_id=$_SESSION['membre_id'];
	$query2 = $bdd->prepare('UPDATE oeuvre_artiste SET oeuvre_id=:oeuvre_id, image_oeuvre=:image_oeuvre, titre_oeuvre=:titre_oeuvre, description_oeuvre=:description_oeuvre, oeuvre_categorie=:oeuvre_categorie, oeuvre_style=:oeuvre_style, date_crea=:date_crea WHERE oeuvre_id=:oeuvre_id AND artiste_id=:artiste_id');
	$query2->bindValue(':artiste_id', $artiste_id, PDO::PARAM_INT);
	$query2->bindValue(':oeuvre_id', $oeuvre_id, PDO::PARAM_INT);
	$query2->bindValue(':image_oeuvre', $imageoeuvre, PDO::PARAM_STR);
	$query2->bindValue(':titre_oeuvre', $titreoeuvre, PDO::PARAM_STR);
	$query2->bindValue(':description_oeuvre', $descriptionoeuvre, PDO::PARAM_STR);
	$query2->bindValue(':oeuvre_categorie', $categorie, PDO::PARAM_STR);
	$query2->bindValue(':oeuvre_style', $style, PDO::PARAM_STR);
	$query2->bindValue(':date_crea', $date_crea, PDO::PARAM_INT);
	$query2->execute();
	}
catch (Exception $e)
{
        echo 'Erreur : ' . $e->getMessage();
}
	echo '<p class="textevalide">'."Votre modification à bien été effectué !".'</p>';
}
}	
		$query->CloseCursor();
Merci pour votre attention et votre aide.