mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2024-11-23 20:58:46 -05:00
Added db class
This commit is contained in:
parent
9af0207549
commit
1c8aea09b3
42
classes/db-class.php
Normal file
42
classes/db-class.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
|
||||
class SSDB
|
||||
{
|
||||
function execute($link,$sql){
|
||||
if ($result = mysqli_query($link, $sql)) {
|
||||
return true;
|
||||
} else {
|
||||
die("SQL Failure.Traceback:" . $sql . " Detailed info:" . mysqli_error($link));
|
||||
}
|
||||
}
|
||||
function getSetting($link,$setting){
|
||||
$sql = "SELECT value FROM settings WHERE setting=\"".$setting."\";";
|
||||
if($result = mysqli_query($link, $sql)){
|
||||
if(mysqli_num_rows($result) == 1){
|
||||
while($row = mysqli_fetch_array($result)){
|
||||
return $row['value'];
|
||||
}
|
||||
}
|
||||
else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
function setSetting($link,$settingname,$settingvalue){
|
||||
$sql = "INSERT INTO settings (setting,value) VALUES ('".$settingname."','".$settingvalue."');";
|
||||
if ($result = mysqli_query($link, $sql)) {
|
||||
return true;
|
||||
} else {
|
||||
die("SQL Failure.Traceback:" . $sql . " Detailed info:" . mysqli_error($link));
|
||||
}
|
||||
}
|
||||
function deleteSetting($link,$settingname){
|
||||
$sql = "DELETE FROM settings WHERE setting=\"".$settingname."\";";
|
||||
if ($result = mysqli_query($link, $sql)) {
|
||||
return true;
|
||||
} else {
|
||||
die("SQL Failure.Traceback:" . $sql . " Detailed info:" . mysqli_error($link));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user