您好我有以下插页:
$full_pjt_save = array(
'img_copertina' => $this->input->post('copertine'),
'physical_already' => $this->input->post('physical_already'),
'physical_format_product' => $this->input->post('formato_fisico'),
'physical_format' => $this->input->post('physical_format'),
'physical_format_vinile' => $this->input->post('formato_vinile'),
'physical_boxqty' => $this->input->post('physical_boxqty'),
'physical_tot_time' => $this->input->post('physical_tot_time'),
'physical_qty' => $this->input->post('physical_qty'),
'sale_price' => $this->input->post('sale_price'),
'keywords' => $this->input->post('keywords'),
'descrizione' => $this->input->post('descrizione'),
'durata' => $this->input->post('durata'),
);
$added_fields = $full_pjt_save+array('last_mod' => time());
$this->db->where('id_acquisto', $this->input->post('id_acquisto'));
$save_full_pjt_to_db = $this->db->update('progetti_'.$pjt_table, $added_fields);
$pjt_table_id = $this->db->insert_id();
这样可以正常工作,但我有一个下拉项目,其中'formato_vinile'就是这样:
45 Giri (7" Singolo, 45 Giri)
但是在双引号之后插入db cut:
45 Giri (7
有没有办法完整地写出来?
答案 0 :(得分:0)
只是转义输入$this->input->post(mysqli::escape_string ('formato_vinile'))
道歉不是静态调用,虽然在CI中我是一个伪代码(我不是用户)
$this->db->escape_str() ;
答案 1 :(得分:0)
好吧因为我不能把它写成代码的评论原因......在这里我的想法:
它的快速和肮脏所以你应该稍微修改它。
$added_fields = $full_pjt_save+array('last_mod' => time());
$this->db->where('id_acquisto', $this->input->post('id_acquisto'));
$this->db->set('physical_format_vinile', $this->input->post('formato_vinile'), FALSE);
$save_full_pjt_to_db = $this->db->update('progetti_'.$pjt_table, $added_fields);
$pjt_table_id = $this->db->insert_id();
注意取消/删除$added_fields
数组中的关键字physical_format_vinile
它没有经过测试,但我希望它有助于或让您了解如何处理您的问题。
*编辑让我们可以检查确切问题的位置。你可以做一个var_dump($this->input->post('formato_vinile'))
并检查双引号是否仍然正确吗?