PHP and database links

Source: Internet
Author: User
PHP and database links I have read about the DISCUZ database tool class I have a question: & nbsp; function & nbsp; dql ($ SQL) & nbsp; & nbsp; {& nbsp; & nbsp; & PHP connection to database
I read the DISCUZ database tool class.
I have a question:
Function dql ($ SQL)
{
$ Res = $ this-> mysqli-> query ($ SQL );
If (! Empty ($ res ))
{
$ Arr = array ();
While ($ row = $ res-> fetch_row ())
{$ Arr [] = $ row ;}
Return $ arr;
$ Res-> free_result ();
} Else
{Return null ;}
It turns the data obtained from the database into an array $ ROW and stores $ row to $ arr. then, it returns a two-dimensional array.
Why not a $ row is returned directly? Why two more packages?
------ Solution ----------------------
Returns a $ row. how do you get all records.
------ Solution ----------------------
If only $ row is returned, only the last row is obtained.
A two-dimensional array is returned, and multiple data entries in the table structure are returned.

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.