1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
public function update() {
// CHANGE THIS : exemple d'utilisation
$sql = 'UPDATE `' . self::TABLE_NAME . '` SET `'
. self::FIELD_START . '` = STR_TO_DATE(:start, \'%Y-%m-%d\'), `'
. self::FIELD_END . '` = STR_TO_DATE(:end, \'%Y-%m-%d\'), `'
. self::FIELD_PRICE . '` = :price, `'
. self::FIELD_DEPARTURE . '` = :departure, `'
. self::FIELD_ARRIVAL . '` = :arrival '
. ' where id_stay = ' . $this->_id;
$this->_select = $this->_con->prepare($sql);
$this->_select->bindParam(':start', $this->_start, PDO::PARAM_STR, 8);
$this->_select->bindParam(':end', $this->_end, PDO::PARAM_STR, 8);
$this->_select->bindParam(':price', $this->_price, PDO::PARAM_INT, 4);
$this->_select->bindParam(':departure', $this->_departure_time, PDO::PARAM_STR, 5);
$this->_select->bindParam(':arrival', $this->_arrival_time, PDO::PARAM_STR, 5);
$this->exe(); // simple exécution de la requète avec stockage du retour et gestion des erreurs. Utilisé partout, n'est pas concerné par le problème.
} |