How does php form a number for mysql Query results. For example, I use SQL = select id, title from table
There are three records,
Is there any way to make his results form an array?
==========================================================
Title 1, Title 2, Title 3
======================================
$ Query = mysql_query ($ SQL );
While ($ row = mysql_fetch_array ($ query ))
{
Echo "$ row [title]";
}
It seems not good to use this method.
Reply to discussion (solution)
You just need to add an array in the loop. this is a stupid way!
Since php 5.5 has included mysql extensions in the column to be abolished
So from now on, you need to get rid of the mysql extension habit.
PDOStatement: fetchAll
Mysqli_result: fetch_all
Can generate an array of query results
Since php 5.5 has included mysql extensions in the column to be abolished
So from now on, you need to get rid of the mysql extension habit.
PDOStatement: fetchAll
Mysqli_result: fetch_all
Can generate an array of query results
How can this be used?
While ($ row = mysql_fetch_array ($ query ))
{
$ Ar [] = $ row [title];
}
Print_r ($ ar );
If you find implementation troublesome, we recommend that you find a php mysql class library.