Questions about passing parameters in php-php Tutorial

Source: Internet
Author: User
Tags idn
I want to call the getStaffListByLID function in the loop of the getStaffListByID function, but the value of lid in getStaffListByLID does not appear to be passed. what can I do? PHPcodefunctiongetStaffListByID ($ con) {global $ idn, $ id, $ pic, $ name; php parameter passing problem
I want to call the getStaffListByLID function in the loop of the getStaffListByLID function, but it seems that the value of lid in getStaffListByLID is not passed. what can I do?
PHP code
  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");        }    }


------ Solution --------------------
I do not believe
Add a var_dump ($ lid) to the getStaffListByLID function );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.