@@ -278,9 +278,33 @@ public function save() {
278278 }
279279 try {
280280 $ stmt = Common::$ database ->prepare ('
281- UPDATE
282- `user_profiles`
283- SET
281+ INSERT INTO `user_profiles` (
282+ `biography`,
283+ `discord_username`,
284+ `facebook_username`,
285+ `github_username`,
286+ `instagram_username`,
287+ `phone`,
288+ `reddit_username`,
289+ `skype_username`,
290+ `steam_id`,
291+ `twitter_username`,
292+ `user_id`,
293+ `website`
294+ ) VALUES (
295+ :bio,
296+ :discord,
297+ :fb,
298+ :github,
299+ :ig,
300+ :ph,
301+ :reddit,
302+ :skype,
303+ :steam,
304+ :twitter,
305+ :user_id,
306+ :website
307+ ) ON DUPLICATE KEY UPDATE
284308 `biography` = :bio,
285309 `discord_username` = :discord,
286310 `facebook_username` = :fb,
@@ -291,11 +315,9 @@ public function save() {
291315 `skype_username` = :skype,
292316 `steam_id` = :steam,
293317 `twitter_username` = :twitter,
318+ `user_id` = :user_id,
294319 `website` = :website
295- WHERE
296- `user_id` = :id
297- LIMIT 1;
298- ' );
320+ ; ' );
299321 $ stmt ->bindParam (':bio ' , $ this ->biography , PDO ::PARAM_STR );
300322 $ stmt ->bindParam (':discord ' , $ this ->discord_username , PDO ::PARAM_STR );
301323 $ stmt ->bindParam (':fb ' , $ this ->facebook_username , PDO ::PARAM_STR );
@@ -307,6 +329,7 @@ public function save() {
307329 $ stmt ->bindParam (':skype ' , $ this ->skype_username , PDO ::PARAM_STR );
308330 $ stmt ->bindParam (':steam ' , $ this ->steam_id , PDO ::PARAM_STR );
309331 $ stmt ->bindParam (':twitter ' , $ this ->twitter_username , PDO ::PARAM_STR );
332+ $ stmt ->bindParam (':user_id ' , $ this ->id , PDO ::PARAM_INT );
310333 $ stmt ->bindParam (':website ' , $ this ->website , PDO ::PARAM_STR );
311334 if (!$ stmt ->execute ()) {
312335 throw new QueryException ('Cannot save user profile ' );
@@ -315,6 +338,7 @@ public function save() {
315338
316339 $ object = new StdClass ();
317340 $ object ->biography = $ this ->biography ;
341+ $ object ->discord_username = $ this ->discord_username ;
318342 $ object ->facebook_username = $ this ->facebook_username ;
319343 $ object ->github_username = $ this ->github_username ;
320344 $ object ->id = $ this ->id ;
0 commit comments