php传参的问题
我想在getStaffListByID函数的循环中调用getStaffListByLID函数,但是到getStaffListByLID里貌似lid的值没有传过来,请问怎么办?
function getStaffListByID($con){ global $idn,$id,$pic,$name; $sel = "select id,pic,name from student;"; $ret = pg_Exec($con,$sel); $idn = pg_NumRows($ret); for ( $i=0; $i<$idn; $i++ ) { $id[$i] = pg_Result($ret, $i, "id"); echo '$id[$i]'.$id[$i]; $lid = $id[$i]; getStaffListByLID($con,$lid); $pic{$id[$i]} = pg_Result($ret, $i, "pic"); $name{$id[$i]} = pg_Result($ret, $i, "name"); } } function getStaffListByLID($con,$lid){ global $tidn,$tid,$tpic,$tname; echo 'ereree'.$lid; $sel = "select tid,tpic,tname from teacher;"; $ret = pg_Exec($con,$sel); $tidn = pg_NumRows($ret); for ( $i=0; $i<$tidn; $i++ ) { $lid[$i] = pg_Result($ret, $i, "tid"); $lpic{$id[$i]} = pg_Result($ret, $i, "tpic"); $lname{$id[$i]} = pg_Result($ret, $i, "tname"); } }