我们如何在sql中的一列中将多个数据插入到表中

时间:2016-10-27 04:55:32

标签: codeigniter

$query= $this->db->query("INSERT INTO _errorlog SET errors = ".$this->db->escape($post['season']).$this->db->escape($post['venue']).$this->db->escape($post['week'])($post['home_team']).$this->db->escape($post['away_team']));

2 个答案:

答案 0 :(得分:0)

请尝试这个,

$query= $this->db->query("INSERT INTO _errorlog SET errors = ".$this->db->escape($post['season']).$this->db->escape($post['venue']).$this->db->escape($post['week']).$this->db->escape($post['home_team']).$this->db->escape($post['away_team']));

答案 1 :(得分:0)

您的数据库查询错误。

在您的数据库查询中检查($ post ['home_team']),看起来您忘了添加。$ this-> dbc-> escape()。

 $q = INSERT INTO _errorlog SET errors = ".$this->db->escape($post['season']).$this->db->escape($post['venue']).$this->db->escape($post['week'])($post['home_team']).$this->db->escape($post['away_team'])

所以你的查询应该是这个。

  $q = 'INSERT INTO _errorlog SET errors = "'.$this->db->escape($post['season']).$this->db->escape($post['venue']).$this->db->escape($post['week']).$this->db->escape($post['home_team']).$this->db->escape($post['away_team']).'"';