带有MySQL查询结果的数组[重复]

I'm trying to get the result of a MySQL query in a PHP array.

Basically, the query is supposed to get a list of unique page_id from a table. The result should be displayed in a div.

This is the code I'm using:

$query = "SELECT DISTINCT page_id FROM hist" ;

$paginas=array();

$result=mysqli_query($link,$query) or die(mysql_error());

while ($row=mysql_fetch_array($result)){
    $paginas=array_fill(count($paginas), 46, $row['page_id']);
};

mysqli_close($link);

echo '<div id="paginas">';
print_r ($paginas);
echo "</div>";

This is giving me an empty array (displays "Array()") and the error: Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in (my line 4 above)

</div>

I found the problem correcting:

while ($row=mysql_fetch_array($result)){

to

while ($row=mysqli_fetch_array($result)){

It's because you are mixing mysqli functions with mysql_