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 deletions
—
download
Diffstat
Diff options
+12/-4
M database.php
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
|
|
/**
|