Public feed #889684

Miscellany

public text v1 · immutable
Raw Edit
·published 2008-02-03 02:34 UTC
rendered paste body
   
<?
mysql_connect("localhost", "copperle_admin", "family");
mysql_select_db("copperle_family");
$sql = "SELECT * FROM imagedata WHERE date > ".(time()-30*24*60*60)." ORDER BY date DESC";
      
$result = mysql_query($sql);

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

$ids = array();

for($i = 0; count($ids) < 4; $i++)
{
  $entry = $array[rand(0, count($array)-1)];

  if(!array_key_exists($entry['date'], $ids))
    $ids[$entry['date']] = $entry;
}

foreach($ids as $value) {

echo "<img class="recentImageList" src="$value[thumb_path]" />";

}

?>