Code Duplication    Length = 5-6 lines in 3 locations

php/JodelAccount.php 3 locations

@@ 479-484 (lines=6) @@
476
477
        $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')");
478
        
479
        if($result === false)
480
        {
481
            $error = db_error();
482
            echo $error;
483
            error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error);
484
        }
485
486
        if($result->num_rows == 0)
487
        {
@@ 511-515 (lines=5) @@
508
        $result = $db->query("INSERT INTO votes (device_uid, postId, type)
509
                        VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
510
        
511
        if($result === false){
512
                $error = db_error();
513
                echo $error;
514
                echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
515
        }       
516
    }
517
518
    function registerAccount($location) {
@@ 543-548 (lines=6) @@
540
                        "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
541
542
        $success = TRUE;
543
        if($result === false){
544
                $error = $db->error();
545
                echo $error;
546
                echo "Adding account failed: (" . $result->errno . ") " . $result->error;
547
                $success = FALSE;
548
        }   
549
        
550
        return $device_uid;
551
    }