PHP MySQLi mysqli_fetch_array Returns 多个数组

PHP MySQLi mysqli_fetch_array Returns multiple arrays

我正在尝试创建单列数据的一维枚举数组。

$dbc_db_filenames       = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$query_db_filenames     = "SELECT file FROM transactions_tb WHERE file != ''";
$get_db_filenames       = mysqli_query($dbc_db_filenames, $query_db_filenames);
$array_rows             = array();
while($rows             = mysqli_fetch_array($get_db_filenames, MYSQLI_NUM)) {
    $array_rows = $rows;
    echo "<br /><br /><pre>";
    print_r($array_rows);
    echo "</pre><br />";
}
mysqli_close($dbc_db_filenames);

目前正在 return 像这样处理多个数组:

Array
(
    [0] => 2_20140908130612381070.jpg
)

Array
(
    [0] => 2_20140908131122368017.jpg
)

Array
(
    [0] => 2_20140908130449345689.jpg
)

我想要它 return 一个这样的数组:

Array
(
    [0] => 2_20140908130612381070.jpg
    [1] => 2_20140908131122368017.jpg
    [2] => 2_20140908130449345689.jpg
)

我正在将目录内容与上传时存储在数据库中的文件名进行比较。要将目录内容放入数组中,我使用以下代码:

$list = scandir(UPLOAD_PATH);
echo '<br /><br /><pre>';
print_r($list);
echo '</pre><br />';

我想要哪种return数组:

Array
(
    [0] => 2_20140908130612381070.jpg
    [1] => 2_20140908131122368017.jpg
    [2] => 2_20140908130449345689.jpg
)

你试过吗?

while($rows             = mysqli_fetch_array($get_db_filenames, MYSQLI_NUM)) {
    $array_rows[] = $rows[0];
}

echo "<pre>";
print_r($array_rows);
echo "</pre>";