kopia lustrzana https://github.com/magicbug/Cloudlog
Added option_name to table
rodzic
1bf2840e27
commit
59f81279e3
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue