| 12
 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
 
 | $rqt = $db->prepare('REPLACE INTO elements VALUES (:id,:x,:y,:long,:larg,:rayon,:angle,:positionnom);');
 
		if (empty($this->id)) // Nouvel objet, sinon objet déjà existant
			$rqt->bindValue(':id', null, PDO::PARAM_NULL);
 
		$rqt->bindValue(':x',$x);
		$rqt->bindValue(':y',$y);
 
		// Si vide, on remplace par la valeur par défaut
		if (empty($long))
			$rqt->bindValue(':long', null, PDO::PARAM_NULL);
		else
			$rqt->bindValue(':long',$long, PDO::PARAM_INT);
 
		if (empty($larg))
			$rqt->bindValue(':larg', null, PDO::PARAM_NULL);
		else
			$rqt->bindValue(':larg',$larg, PDO::PARAM_INT);
 
		if (empty($rayon))
			$rqt->bindValue(':rayon', null, PDO::PARAM_NULL);
		else
			$rqt->bindValue(':rayon',$rayon, PDO::PARAM_INT);
 
		if (empty($angle))
			$rqt->bindValue(':angle', null, PDO::PARAM_NULL);
		else
			$rqt->bindValue(':angle',$angle, PDO::PARAM_INT);
 
		// Si la position du texte n'est pas définie, la position par défaut est "up"
		if (empty($this->position_nom))
			$rqt->bindValue(':positionnom',"up", PDO::PARAM_STR);
		else
			$rqt->bindValue(':positionnom',$position_nom, PDO::PARAM_STR);
 
		$rqt->execute(); | 
Partager