Code Duplication    Length = 5-6 lines in 3 locations

php/JodelAccount.php 3 locations

@@ 419-424 (lines=6) @@
416
417
        $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')");
418
        
419
        if($result === false)
420
        {
421
            $error = db_error();
422
            echo $error;
423
            error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error);
424
        }
425
426
        if($result->num_rows == 0)
427
        {
@@ 451-455 (lines=5) @@
448
        $result = $db->query("INSERT INTO votes (device_uid, postId, type)
449
                        VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
450
        
451
        if($result === false){
452
                $error = db_error();
453
                echo $error;
454
                echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
455
        }       
456
    }
457
458
    function registerAccount($location) {
@@ 483-488 (lines=6) @@
480
                        "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
481
482
        $success = TRUE;
483
        if($result === false){
484
                $error = db_error();
485
                echo $error;
486
                echo "Adding account failed: (" . $result->errno . ") " . $result->error;
487
                $success = FALSE;
488
        }   
489
        
490
        return $device_uid;
491
    }