@@ -323,21 +323,79 @@ public function save() {
323
323
`user_id` = :user_id,
324
324
`website` = :website
325
325
; ' );
326
- $ stmt ->bindParam (':bio ' , $ this ->biography , PDO ::PARAM_STR );
327
- $ stmt ->bindParam (':discord ' , $ this ->discord_username , PDO ::PARAM_STR );
328
- $ stmt ->bindParam (':fb ' , $ this ->facebook_username , PDO ::PARAM_STR );
329
- $ stmt ->bindParam (':github ' , $ this ->github_username , PDO ::PARAM_STR );
330
- $ stmt ->bindParam (':ig ' , $ this ->instagram_username , PDO ::PARAM_STR );
331
- $ stmt ->bindParam (':ph ' , $ this ->phone , PDO ::PARAM_STR );
332
- $ stmt ->bindParam (':reddit ' , $ this ->reddit_username , PDO ::PARAM_STR );
333
- $ stmt ->bindParam (':skype ' , $ this ->skype_username , PDO ::PARAM_STR );
334
- $ stmt ->bindParam (':steam ' , $ this ->steam_id , PDO ::PARAM_STR );
335
- $ stmt ->bindParam (':twitter ' , $ this ->twitter_username , PDO ::PARAM_STR );
326
+
327
+ if (is_null ($ this ->biography )) {
328
+ $ stmt ->bindParam (':bio ' , $ this ->biography , PDO ::PARAM_NULL );
329
+ } else {
330
+ $ stmt ->bindParam (':bio ' , $ this ->biography , PDO ::PARAM_STR );
331
+ }
332
+
333
+ if (is_null ($ this ->discord_username )) {
334
+ $ stmt ->bindParam (':discord ' , $ this ->discord_username , PDO ::PARAM_NULL );
335
+ } else {
336
+ $ stmt ->bindParam (':discord ' , $ this ->discord_username , PDO ::PARAM_STR );
337
+ }
338
+
339
+ if (is_null ($ this ->facebook_username )) {
340
+ $ stmt ->bindParam (':fb ' , $ this ->facebook_username , PDO ::PARAM_NULL );
341
+ } else {
342
+ $ stmt ->bindParam (':fb ' , $ this ->facebook_username , PDO ::PARAM_STR );
343
+ }
344
+
345
+ if (is_null ($ this ->github_username )) {
346
+ $ stmt ->bindParam (':github ' , $ this ->github_username , PDO ::PARAM_NULL );
347
+ } else {
348
+ $ stmt ->bindParam (':github ' , $ this ->github_username , PDO ::PARAM_STR );
349
+ }
350
+
351
+ if (is_null ($ this ->instagram_username )) {
352
+ $ stmt ->bindParam (':ig ' , $ this ->instagram_username , PDO ::PARAM_NULL );
353
+ } else {
354
+ $ stmt ->bindParam (':ig ' , $ this ->instagram_username , PDO ::PARAM_STR );
355
+ }
356
+
357
+ if (is_null ($ this ->phone )) {
358
+ $ stmt ->bindParam (':ph ' , $ this ->phone , PDO ::PARAM_NULL );
359
+ } else {
360
+ $ stmt ->bindParam (':ph ' , $ this ->phone , PDO ::PARAM_STR );
361
+ }
362
+
363
+ if (is_null ($ this ->reddit_username )) {
364
+ $ stmt ->bindParam (':reddit ' , $ this ->reddit_username , PDO ::PARAM_NULL );
365
+ } else {
366
+ $ stmt ->bindParam (':reddit ' , $ this ->reddit_username , PDO ::PARAM_STR );
367
+ }
368
+
369
+ if (is_null ($ this ->skype_username )) {
370
+ $ stmt ->bindParam (':skype ' , $ this ->skype_username , PDO ::PARAM_NULL );
371
+ } else {
372
+ $ stmt ->bindParam (':skype ' , $ this ->skype_username , PDO ::PARAM_STR );
373
+ }
374
+
375
+ if (is_null ($ this ->steam_id )) {
376
+ $ stmt ->bindParam (':steam ' , $ this ->steam_id , PDO ::PARAM_NULL );
377
+ } else {
378
+ $ stmt ->bindParam (':steam ' , $ this ->steam_id , PDO ::PARAM_STR );
379
+ }
380
+
381
+ if (is_null ($ this ->twitter_username )) {
382
+ $ stmt ->bindParam (':twitter ' , $ this ->twitter_username , PDO ::PARAM_NULL );
383
+ } else {
384
+ $ stmt ->bindParam (':twitter ' , $ this ->twitter_username , PDO ::PARAM_STR );
385
+ }
386
+
336
387
$ stmt ->bindParam (':user_id ' , $ this ->user_id , PDO ::PARAM_INT );
337
- $ stmt ->bindParam (':website ' , $ this ->website , PDO ::PARAM_STR );
388
+
389
+ if (is_null ($ this ->website )) {
390
+ $ stmt ->bindParam (':website ' , $ this ->website , PDO ::PARAM_NULL );
391
+ } else {
392
+ $ stmt ->bindParam (':website ' , $ this ->website , PDO ::PARAM_STR );
393
+ }
394
+
338
395
if (!$ stmt ->execute ()) {
339
396
throw new QueryException ('Cannot save user profile ' );
340
397
}
398
+
341
399
$ stmt ->closeCursor ();
342
400
343
401
$ object = new StdClass ();
0 commit comments