Fix database date: 0000-00-00 -> NULL

This commit is contained in:
Chocobozzz
2017-02-05 17:07:56 +01:00
parent 1aac22b46d
commit ab7f85b404
14 changed files with 125 additions and 28 deletions
+5 -2
View File
@@ -119,8 +119,8 @@
$phone = "";
$online = 0;
$enable = 1;
$start = "0000-00-00";
$end = "0000-00-00";
$start = NULL;
$end = NULL;
$req = $bdd->prepare('INSERT INTO user (user_id, user_pass, user_mail, user_phone, user_online, user_enable, user_start_date, user_end_date)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
@@ -154,6 +154,9 @@
if ($field === 'user_pass') {
$value = hashPass($value);
}
else if (($field === 'user_start_date' || $field === 'user_end_date') && $value === '') {
$value = NULL;
}
// /!\ SQL injection: field was checked with in_array function
$req_string = 'UPDATE user SET ' . $field . ' = ? WHERE user_id = ?';