updateUserLocation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 7
rs 10
1
<?php
2
function updateUserBio($username, $bio, $connection) {
3
        $stmt = $connection->prepare("UPDATE users SET bio = ? WHERE username = ?");
4
        $stmt->bind_param("ss", $bio, $username);
5
        $stmt->execute();
6
	$stmt->close();
7
8
	return true;
9
}
10
11
function updateUserCSS($username, $css, $connection) {
12
        $stmt = $connection->prepare("UPDATE users SET css = ? WHERE username = ?");
13
        $stmt->bind_param("ss", $css, $username);
14
        $stmt->execute();
15
    $stmt->close();
16
17
    return true;
18
}
19
20
function updateUserBG($username, $bg, $connection) {
21
    $stmt = $connection->prepare("UPDATE users SET bg = ? WHERE username = ?");
22
    $stmt->bind_param("ss", $bg, $username);
23
    $stmt->execute();
24
    $stmt->close();
25
26
    return true;
27
}
28
29
function updateUserGender($username, $gender, $connection) {
30
        $stmt = $connection->prepare("UPDATE users SET gender = ? WHERE username = ?");
31
        $stmt->bind_param("ss", $gender, $username);
32
        $stmt->execute();
33
    $stmt->close();
34
35
    return true;
36
}
37
38
function updateUserSong($username, $gender, $connection) {
39
    $stmt = $connection->prepare("UPDATE users SET song = ? WHERE username = ?");
40
    $stmt->bind_param("ss", $gender, $username);
41
    $stmt->execute();
42
$stmt->close();
43
44
return true;
45
}
46
47
function updateUserAge($username, $age, $connection) {
48
        $stmt = $connection->prepare("UPDATE users SET age = ? WHERE username = ?");
49
        $stmt->bind_param("ss", $age, $username);
50
        $stmt->execute();
51
    $stmt->close();
52
53
    return true;
54
}
55
56
function updateUserLocation($username, $location, $connection) {
57
        $stmt = $connection->prepare("UPDATE users SET location = ? WHERE username = ?");
58
        $stmt->bind_param("ss", $location, $username);
59
        $stmt->execute();
60
    $stmt->close();
61
62
    return true;
63
}
64
65
function updateUserInterest($username, $interests, $connection) {
66
        $stmt = $connection->prepare("UPDATE users SET interests = ? WHERE username = ?");
67
        $stmt->bind_param("ss", $interests, $username);
68
        $stmt->execute();
69
    $stmt->close();
70
71
    return true;
72
}
73
74
function updateUserInterestMusic($username, $interests, $connection) {
75
        $stmt = $connection->prepare("UPDATE users SET interestsmusic = ? WHERE username = ?");
76
        $stmt->bind_param("ss", $interests, $username);
77
        $stmt->execute();
78
    $stmt->close();
79
80
    return true;
81
}
82
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...