Php 为一个人而不是几个人选择返回结果的语句
当有多个姓氏相同时,搜索名称将返回一个结果。它可能是foreach循环,但我认为它是activerecord语句 模型 看法Php 为一个人而不是几个人选择返回结果的语句,php,codeigniter,activerecord,Php,Codeigniter,Activerecord,当有多个姓氏相同时,搜索名称将返回一个结果。它可能是foreach循环,但我认为它是activerecord语句 模型 看法 if(isset($user)){ foreach($user as$res){ echo“employee id=”.$res['emp_no'];?>您的返回值在for循环中。将返回语句从foreach循环中取出 foreach ($result->result() as $row ) { $entry = array(); $entry
if(isset($user)){
foreach($user as$res){
echo“employee id=”.$res['emp_no'];?>
您的返回值在for
循环中。将返回语句从foreach循环中取出
foreach ($result->result() as $row )
{
$entry = array();
$entry['emp_no'] = $row->emp_no;
$entry['first_name'] = $row->first_name;
$entry['last_name'] = $row->last_name;
$entry['title'] = $row->title;
$entry['dept_no'] = $row->dept_no;
$data[] = $entry;
}
return $data;
真不敢相信我忽略了这一点,塔克斯。
if (isset($user)) {
foreach ($user as $res) {
echo "employee id =" .$res['emp_no']; ?> <br> <?php
echo "first name = " .$res['first_name']; ?> <br> <?php
echo "last name = " .$res['last_name']; ?> <br> <?php
echo "title = " .$res['title']; ?> <br> <?php
echo "department no = " .$res['dept_no']; ?> <br><br> <?php
foreach ($result->result() as $row )
{
$entry = array();
$entry['emp_no'] = $row->emp_no;
$entry['first_name'] = $row->first_name;
$entry['last_name'] = $row->last_name;
$entry['title'] = $row->title;
$entry['dept_no'] = $row->dept_no;
$data[] = $entry;
}
return $data;