-2

我的 Codeigintor 安装出现以下错误,我似乎无法解决

Severity: Notice

Message: Array to string conversion

Filename: models/upload_model.php

Line Number: 69

这是我的代码:

foreach($data as $field){
  $query = $this->db->get_where('Ushers', array('Date' => $field['Date']));
  $result_array = $query->row_array();
  if(empty($result_array)){
    $query = $this->db->get_where('Ushers_teams', array('Team' => $field['Team']));
    $ushers = $query->result_array();
    $doublebooking = FALSE;
    foreach($ushers as $usher){
      $columns = $this->db->list_fields('worship'); 
      $sql = "SELECT * FROM worship WHERE worship.Date LIKE '".$field['Date']."%'"; 
      foreach($columns as $column){ 
      $sql .= " OR worship.".(string)$column." = '".(string)$usher."'"; 
    } 
    $result = $this->db->query($sql);
    $usher = $result->result_array();
    if(!isEmpty($usher)) $doublebooking = TRUE;
  }

  if(!$doublebooking){
    $this->db->insert('ushers', $field);
    print("Succesfully uploaded roster for week: ".$field['Date']);
  }else{
    print("Some ushers are already rostered onto the worship team on ".$field['Date']);
  }
}else{
  print("The is already a ushers roster for ".$field['Date'].".");
  print("<br>");
}

我知道这不是解决问题的最佳方法,由于遇到同样的问题,这是最后的手段。错误当前位于包含

$sql .= " OR worship.".(string)$column." = '".(string)$usher."'";

这可能是一个简单的问题,但我现在已经解决了 5 到 6 个小时。

4

1 回答 1

3

$usher是一个数组,我想你会发现。$ushers是一个数组数组。$usherwill 将是一个数组,在 ushers 表中的每一列都有一个字段。你可能想要$usher['name']$usher['id']类似的东西。无法从信息中准确说出什么。

于 2013-08-12T22:25:21.490 回答