Public feed #890101

Unnamed

public text v1 · immutable
Raw Edit
·published 2008-02-03 13:46 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=\"".substr($value[thumb_path], strpos($value[thumb_path], "/cfa"))."\" />";
 
 }

?>