Like me sql=select id,title from table
There are three records,
Is there any way to get his results to form an array
========================================
Heading 1, Heading 2, Heading 3
=======================
$query = mysql_query ($sql);
while ($row = Mysql_fetch_array ($query))
{
echo "$row [title]";
}
It doesn't seem so good to use this way.
Reply to discussion (solution)
You build the number in the loop and add it in. It's a stupid way!
Since PHP 5.5 has added MySQL extensions to the list to be abolished
So from now on you need to get rid of the habit of using MySQL extension
Pdostatement::fetchall
Mysqli_result::fetch_all
can produce an array of query results
Since PHP 5.5 has added MySQL extensions to the list to be abolished
So from now on you need to get rid of the habit of using MySQL extension
Pdostatement::fetchall
Mysqli_result::fetch_all
can produce an array of query results
How does this work?
while ($row = Mysql_fetch_array ($query))
{
$ar []= $row [title];
}
Print_r ($ar);
If you find yourself in trouble, it is recommended to find a PHP MySQL class library