mercredi 2 janvier 2019

Problem in php array is not work with while

I have a php code when I want to show info to the browser it show me : Notice: Array to string conversion in Can You Help Me Please I want to show this information from function because I don't want to create new while one every request.

    function get_school($school_code){
        global $conn,$Lang;
            $school_select      = $conn->query("SELECT * FROM schools WHERE code='$school_code'");
            $school_exs         = $school_select->num_rows;

                if ($school_exs != 0) {
                    $show = array();
                    while ($school_info  = mysqli_fetch_array($school_select)) {
                        $nestedData         = array();
                        $nestedData[]       = $school_info['id'];  
                        $nestedData[]       = $school_info['name'];  
                        $nestedData[]       = $school_info['code'];  
                        $nestedData[]       = $school_info['type'];  
                        $nestedData[]       = $school_info['wilaya'];  
                        $nestedData[]       = $school_info['baladiya'];  
                        $nestedData[]       = $school_info['capacity'];  
                        $nestedData[]       = $school_info['phone'];  
                        $nestedData[]       = $school_info['email'];  
                        $nestedData[]       = $school_info['adress'];
                        $nestedData[]       = $school_info['arabic_name'];
                        $nestedData[]       = $school_info['direction'];
                        $nestedData[]       = $school_info['language'];
                        $show[]             = $nestedData;
                    }

                }else{


                }
        return  $show;
    }

    echo get_school($admin_school_code);




Aucun commentaire:

Enregistrer un commentaire