Added option_name to table

pull/2419/head
int2001 2023-08-18 13:30:04 +00:00
rodzic 1bf2840e27
commit 59f81279e3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DFB1C13CD2DB037B
2 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -11,7 +11,12 @@ class User_Options extends CI_Controller {
public function add_edit_fav() {
$obj = json_decode(file_get_contents("php://input"), true);
$this->user_options_model->set_option('Favourite',$obj);
if ($obj['sat_name'] ?? '' != '') {
$option_name=$obj['sat_name'];
} else {
$option_name=$obj['band'].'/'.$obj['mode'];
}
$this->user_options_model->set_option('Favourite',$option_name, $obj);
}
}

Wyświetl plik

@ -8,11 +8,11 @@ class User_options_model extends CI_Model
return $this->db->get('user_options');
}
public function set_option($option_type, $option_array) {
public function set_option($option_type, $option_name, $option_array) {
$uid=$this->session->userdata('user_id');
$sql='insert into user_options (user_id,option_type,option_key,option_value) values (?,?,?,?) ON DUPLICATE KEY UPDATE option_value=?';
$sql='insert into user_options (user_id,option_type,option_name,option_key,option_value) values (?,?,?,?,?) ON DUPLICATE KEY UPDATE option_value=?';
foreach($option_array as $option_key => $option_value) {
$query = $this->db->query($sql, array($uid, $option_type, $option_key, $option_value, $option_value));
$query = $this->db->query($sql, array($uid, $option_type, $option_name, $option_key, $option_value, $option_value));
}
}