@@ -278,9 +278,33 @@ public function save() {
278
278
}
279
279
try {
280
280
$ 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
284
308
`biography` = :bio,
285
309
`discord_username` = :discord,
286
310
`facebook_username` = :fb,
@@ -291,11 +315,9 @@ public function save() {
291
315
`skype_username` = :skype,
292
316
`steam_id` = :steam,
293
317
`twitter_username` = :twitter,
318
+ `user_id` = :user_id,
294
319
`website` = :website
295
- WHERE
296
- `user_id` = :id
297
- LIMIT 1;
298
- ' );
320
+ ; ' );
299
321
$ stmt ->bindParam (':bio ' , $ this ->biography , PDO ::PARAM_STR );
300
322
$ stmt ->bindParam (':discord ' , $ this ->discord_username , PDO ::PARAM_STR );
301
323
$ stmt ->bindParam (':fb ' , $ this ->facebook_username , PDO ::PARAM_STR );
@@ -307,6 +329,7 @@ public function save() {
307
329
$ stmt ->bindParam (':skype ' , $ this ->skype_username , PDO ::PARAM_STR );
308
330
$ stmt ->bindParam (':steam ' , $ this ->steam_id , PDO ::PARAM_STR );
309
331
$ stmt ->bindParam (':twitter ' , $ this ->twitter_username , PDO ::PARAM_STR );
332
+ $ stmt ->bindParam (':user_id ' , $ this ->id , PDO ::PARAM_INT );
310
333
$ stmt ->bindParam (':website ' , $ this ->website , PDO ::PARAM_STR );
311
334
if (!$ stmt ->execute ()) {
312
335
throw new QueryException ('Cannot save user profile ' );
@@ -315,6 +338,7 @@ public function save() {
315
338
316
339
$ object = new StdClass ();
317
340
$ object ->biography = $ this ->biography ;
341
+ $ object ->discord_username = $ this ->discord_username ;
318
342
$ object ->facebook_username = $ this ->facebook_username ;
319
343
$ object ->github_username = $ this ->github_username ;
320
344
$ object ->id = $ this ->id ;
0 commit comments