0

嗨,我有以下插入:

$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

有没有办法写完整?

4

2 回答 2

0

只是逃避你的输入$this->input->post(mysqli::escape_string ('formato_vinile'))

道歉不是一个静态调用,虽然在 CI 中有点伪代码(我不是用户)

$this->db->escape_str() ;
于 2013-11-08T08:32:04.423 回答
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

它没有经过测试,但我希望它对您有所帮助或让您了解如何处理您的问题。

*edit 可以让我们检查确切的问题出在哪里。你能做一个var_dump($this->input->post('formato_vinile'))检查双引号是否仍然正确吗?

于 2013-11-08T10:22:29.250 回答