Hola, proba si te sirve:
Código PHP:
<?
/*conexion base de datos*/
$database = "BASE DE DATOS";
$table = "TABLA";
$mysql_connect = mysql_connect("localhost","USUARIO","PASSWORD");
$mysql_selectdb = mysql_select_db($database, $mysql_connect);
/*consulta a la base de datos*/
$consulta_filtro = mysql_query("SELECT ID FROM ".$table." WHERE ojos='marrones'");
$cant_filtro = mysql_num_rows($consulta_filtro);
while( $row = mysql_fetch_array($consulta_filtro))
$photo_id[] = $row["ID"];
?>
<script src="assets/javascript/mootools-core-1.3.2.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/javascript/mootools-more-1.3.2.1.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/javascript/funciones.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" language="javascript">window.addEvent("domready", function(){
var foo = <?PHP echo json_encode($photo_id); ?>
var maxLength = <?PHP echo $cant_filtro;?>; // Max Number images
var contadorImagenes = 1
var mosaicoImagenes = new Wall("wall", {
callOnUpdate: function(items){
items.each(function(e, i){
var a = new Element("img[src=/images/"+foo[contadorImagenes]+".jpg]");
contadorImagenes++;
// Reiniciar contador
if( contadorImagenes > maxLength ) contadorImagenes = 1;
})
}
});
// Init Wall
mosaicoImagenes.initWall();
});</script>