Heim > Backend-Entwicklung > PHP-Tutorial > CI里数组转换有关问题

CI里数组转换有关问题

WBOY
Freigeben: 2016-06-13 10:44:35
Original
1031 Leute haben es durchsucht

CI里数组转换问题
查询数组 
$str2="from crm_ltsz_customer_info_def";

if($_POST["EmployeeId"]!="" && $_POST["EmployeeId"]!=null)
{
$str3=" bl_salesman_id=".$_POST["EmployeeId"]." and";
};

$array1[0]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='01'");
  $array1[1]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='02'");
  $array1[2]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='03'");
  $array1[3]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='04'");
  $array1[4]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='05'");
  $array1[5]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='06'");
  $array1[6]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='07'");
  $array1[7]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='08'");
  $array1[8]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='09'");
  $array1[9]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='10'");
  $array1[10]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='11'");
  $array1[11]= $this->db->query('select count(customer_id) as `count` '.$str2.' where '.$str3." year(create_time)=".$_POST["CreateTime"]." and month(create_time)='12'");
 
  $result = array();
  foreach ( $array1 as $v ) {
$result[] = $v->row_array();
  }
  print_r($result);
  exit();

出的结果是
 Array
(
  [0] => Array
  (
  [count] => 0
  )

  [1] => Array
  (
  [count] => 1
  )

  [2] => Array
  (
  [count] => 0
  )

  [3] => Array
  (
  [count] => 0
  )

  [4] => Array
  (
  [count] => 1
  )

  [5] => Array
  (
  [count] => 0
  )

  [6] => Array
  (
  [count] => 1
  )

  [7] => Array

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage