The data queried by php is returned as a string.

Source: Internet
Author: User
The data queried by php is returned as a string public function flowcode (){
$ SQL _user = "select user from zong_code ";
$ Zong_code = M ("zong_code ");
$ Re = $ zong_code-> query ($ SQL _user );
// Var_dump ($ re );
$ Cc = $ this-> arr_foreach ($ re );

$ This-> display ();



}


Public function arr_foreach ($ arr ){

If (! Is_array ($ arr )){
Return false;
}
Foreach ($ arr as $ key => $ val ){
If (is_array ($ val )){

$ This-> arr_foreach ($ val );
}
Else {
Var_dump ($ str1 );
$ Str1 ="". $ Val ."". $ Str1;





}

}
// Echo "dfffffffffff ";

Return $ str1;

}
In this function, how does one query the data in the database? it is a multi-dimensional data group. how does one return the data to $ str1? the return and echo characters can be used, but the return statements cannot be used.


Reply to discussion (solution)

A resource connection is queried and needs to be read by another statement.
For mysql, see mysql_fetch_assoc.

No recursive return value is received during recursive calls.
If (is_array ($ val )){
??? $ This-> arr_foreach ($ val );
}

Agree to the moderator

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.