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.