home » zplus/freepost.git
Author zPlus <-> 2016-06-05 22:14:51
Committer zPlus <-> 2016-06-05 22:14:51
Commit 1e8e839 (patch)
Tree 6ae2d12
Parent(s)

Fix "duplicate key error" when changing to email=''


commits diff: b4eb98c..1e8e839
1 file changed, 12 insertions, 4 deletionsdownload


Diffstat
-rw-r--r-- database.php 16

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+12/-4 M   database.php
index 7961967..1ac173d
old size: 39K - new size: 39K
@@ -824,10 +824,18 @@ class Database
824 824 {
825 825 $query = $this->database->prepare (
826 826 'UPDATE `user`' .
827 - 'SET `about` = ?, `email` = ? ' .
828 - 'WHERE `id` = ?');
829 -
830 - $query->execute (array ($about, $email, $user_id));
827 + 'SET `about` = :about, `email` = :email ' .
828 + 'WHERE `id` = :user_id');
829 +
830 + $query->bindValue (':about', $about, PDO::PARAM_STR);
831 + $query->bindValue (':user_id', $user_id, PDO::PARAM_INT);
832 +
833 + if (NULL == $email || '' == $email)
834 + $query->bindValue (':email', NULL, PDO::PARAM_NULL);
835 + else
836 + $query->bindValue (':email', $email, PDO::PARAM_STR);
837 +
838 + $query->execute ();
831 839 }
832 840
833 841 /**