I have a value and the second one is the model part which is used for storing the data in JSON format. Here spam_management is the column in the table in that I have to store like [{delete:30}]. 30 is the value taken from the selected option. How can I do that?
public function update_selectedspmlds()
{
$value = $this->input->post("value");
$this->approval_model->update_selectedspmlds($value);
}
public function update_selectedspmlds($value)
{
$myJson = '{
"delete": [{
"lastName": '.$value.'
}]
}';
$this->db->insert('pm1cti_details', ['spam_management' => $myJson]);
}