0
배열에 쿼리 검색 결과가 있습니다.next() 및 prev() 배열 요소가 예상대로 작동하지 않습니다.
내 문제는이 배열에서 한 행을 선택하고 다음 및 이전 행을 선택할 수 있어야한다는 것입니다. 여기
이 어떻게 든 작동 내 코드
function getUserProf(array $data, $faceid)
{
//make sure that all data is saved in an array
$userprof = array();
//makes the array with the info we need
foreach ($data as $val)
if ($val['faceid'] == $faceid){
$userprof = array ("id" => $val["id"], "total" => $val["total"], "faceid" => $val["faceid"], "lname" => $val["lname"], "fname" => $val["fname"], "hand" => $val["hand"], "shot1" => $val["shot1"], "shot1" => $val["shot1"], "shot2" => $val["shot2"], "shot3" => $val["shot3"], "shot4" => $val["shot4"], "shot5" => $val["shot5"]);
}
$next = next($data);//to get the next profile
$prev = prev($data);//to get the next profile
$userprofinfo = array('userprof' => $userprof, 'next' => $next);//make a array with the profile and the next prof and the prev prof
//we return an array with the info
return $userprofinfo;
}
이지만, 그것은 나에게 올바른 다음 및 이전 행을 제공하지 않는 이유는 무엇입니까?
좋아하지만, 내가 어떻게이 $ 키 값을 키 입력합니까 ??? –
@ YairVillar 더 나은 예제 – Kaii
완벽한 사람을 위해 수정했습니다. 더 나은 성능을 위해 –