Code Duplication    Length = 5-6 lines in 3 locations

php/JodelAccount.php 3 locations

@@ 405-410 (lines=6) @@
402
403
        $result = $db->query("SELECT id FROM votes WHERE (postId = '" . $postId . "' AND device_uid = '" . $this->deviceUid . "')");
404
        
405
        if($result === false)
406
        {
407
            $error = db_error();
408
            echo $error;
409
            error_log("Adding Vote failed: (" . $result->errno . ") " . $result->error);
410
        }
411
412
        if($result->num_rows == 0)
413
        {
@@ 437-441 (lines=5) @@
434
        $result = $db->query("INSERT INTO votes (device_uid, postId, type)
435
                        VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
436
        
437
        if($result === false){
438
                $error = db_error();
439
                echo $error;
440
                echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
441
        }       
442
    }
443
444
    function registerAccount($location) {
@@ 469-474 (lines=6) @@
466
                        "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
467
468
        $success = TRUE;
469
        if($result === false){
470
                $error = db_error();
471
                echo $error;
472
                echo "Adding account failed: (" . $result->errno . ") " . $result->error;
473
                $success = FALSE;
474
        }   
475
        
476
        return $device_uid;
477
    }