I am trying to make an array which has a random selection of database results in it.
This is what I have so far,
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("photos", $con);
$query="SELECT album FROM albumname ORDER BY RAND() LIMIT 9";
$result= mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$images[] = $row;
}
echo $images[2];
mysql_close($con);
?>
I want to have 9 results in the array, When i echo the $images[] with any number it only responds Array. It does not give the results from the database.