I have MySQL query to column: SELECT column FROM table
. Is there any possibility how I can save result of this query to array?
I have now this code:
$dotazHlasy = mysql_query("SELECT `id_ulohy` FROM `mproud-hlasy` WHERE `id_uzivatele`=".$_SESSION['uzivatel']) or die(mysql_error());
while($radek = mysql_fetch_row($dotazHlasy)){
$hlasy[] = $radek;
};
This return to me:
Array
(
[0] => Array
(
[0] => 4
)
[1] => Array
(
[0] => 3
)
)
I would like get this:
Array
(
[0] => 4
[1] => 3
)
Thank you for your advice.
The easiest way to put one column in array as the following code.
$YouArray = array();
$command = mysql_query("SELECT column FROM table");
while($result = mysql_fetch_array($command))
$YouArray[] = $result['column'];