Try to fix an issue

This commit is contained in:
Yiğit Kerem Oktay 2020-08-16 23:05:27 +03:00 committed by GitHub
parent 5515a2d776
commit 1b9067da1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ class SSDB
{
function execute($conn,$sql){
if ($conn->query($sql) === TRUE) {
$conn->close();
return true;
} else {
return $conn->error;
@ -13,18 +14,21 @@ class SSDB
function getSetting($conn,$setting){
$sql = "SELECT value FROM settings WHERE setting='".$setting."'";
$result = $conn->query($sql);
$ret = "none";
if ($result->num_rows == 1) {
while($row = $result->fetch_assoc()) {
return $row["value"];
$ret = $row["value"];
}
} else {
return "null";
$ret = "null";
}
$conn->close();
return $ret;
}
function setSetting($conn,$settingname,$settingvalue){
$sql = "INSERT INTO settings (setting,value) VALUES ('".$settingname."','".$settingvalue."');";
if ($conn->query($sql) === TRUE) {
$conn->close();
return true;
} else {
return $conn->error;
@ -34,6 +38,7 @@ class SSDB
function deleteSetting($conn,$settingname){
$sql = "DELETE FROM settings WHERE setting=\"".$settingname."\";";
if ($conn->query($sql) === TRUE) {
$conn->close();
return true;
} else {
return $conn->error;