【发布时间】:2015-03-11 06:37:15
【问题描述】:
我有一个数组作为 $result 我从这个选择操作中得到的。我正在使用 codeigniter
$this->db->select('*');
$this->db->from($table);
$this->db->where('User_Id',$User_Id);
$query = $this->db->get();
$results = $query->result();
$result = $results[0];
我想将这些值保存在变量中。我正在做的是
$HeightFrom=$result->HeightFrom;
$HeightTo=$result->HeightTo;
$MaritalStatus=$result->MaritalStatus;
$Religion=$result->Religion;
$MotherTongue=$result->MotherTongue;
$Community=$result->Community;
$ProfileCreatedby=$result->ProfileCreatedby;etc....
但我在 arrary 中有 50 个值。所以想使用 for 循环。我该怎么办?如何编写 for 循环代码。 我的问题是使用 for 循环我想将数组值保存为包含值的变量名
【问题讨论】:
-
你想做什么??
标签: php arrays codeigniter