将MySQL行值存储为Array值

时间:2012-05-28 17:54:45

标签: mysql arrays

$result = mysql_query("SELECT token FROM active_users");

$tokens = array();
while($row = mysql_fetch_assoc($result))
{
    $tokens[] = $row;
}

......有效,但是:

Array
(
    [0] => Array
        (
            [token] => 32166565
        )

    [1] => Array
        (
            [token] => 56566565
        )

)

而我需要它简单地说:

Array
(
    [0] => 32166565
    [1] => 56566565
)

1 个答案:

答案 0 :(得分:3)

试试这个

$token[] = $row['token'];