Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/05/2012, 12:48
juanandeltonio
 
Fecha de Ingreso: abril-2012
Ubicación: Barcelona
Mensajes: 8
Antigüedad: 12 años
Puntos: 0
Busqueda Bucle FOR con Conexión a BD dentro de Ajax

OS dejo aqui el código:

<script type="text/javascript">
$(document).ready(function(){
PhotoWall.init({
el: '#gallery' // Gallery element
,zoom: true // Use zoom
,zoomAction: 'mouseenter' // Zoom on action
,zoomTimeout: 500 // Timeout before zoom
,zoomDuration: 100 // Zoom duration time
,zoomImageBorder: 5 // Zoomed image border size
,showBox: true // Enavle fullscreen mode
,showBoxSocial: true // Show social buttons
,padding: 5 // padding between images in gallery
,lineMaxHeight: 150 // Max set height of pictures line
,lineMaxHeightDynamic: false // Dynamic lineMaxHeight. If set to True,
// then line height will be changing on
// resize, coressponding to
// baseScreenHeight param
,baseScreenHeight: 600 // Base screen size from wich calculating dynamic lineMaxHeight
});
// Max image width form Picasa
// 94, 110, 128, 200, 220, 288, 320, 400, 512, 576, 640, 720, 800, 912,
// 1024, 1152, 1280, 1440, 1600

$.ajax({

<?php

$conexion = mysql_connect("localhost","fscastellbisbal","fscas tellbisbal00") or die (mysql_error());
mysql_selectdb("dbfscastellbisbal",$conexion) or die (mysql_error());
$busqueda = "SELECT * FROM fotos";
$consulta = mysql_query($busqueda,$conexion);
$numerofotos = mysql_num_rows($consulta);

for ($i =0; $i <$numerofotos;$i++){

$fotos = mysql_fetch_assoc($consulta);

$id = $fotos['id'];
$iduser = $fotos['iduser'];
$idalbum = $fotos ['idalbum'];

echo"
url: 'https://picasaweb.google.com/data/feed/api/user/$iduser/albumid/$idalbum'
";

}

?>

+'/?alt=json&fields=entry(gphoto:id,title,media:group (media:thumbnail,media:'
+'content))&imgmax=720',
dataType: 'jsonp',
success: function(data){
var photos = {}
if(!data.feed.entry) return;
for(var i in data.feed.entry) {
var e = data.feed.entry[i].media$group;
var id = data.feed.entry[i].gphoto$id.$t;

var t1h = e.media$thumbnail[2].height;
var t1w = e.media$thumbnail[2].width;
var t1src = e.media$thumbnail[2].url

var t2w = Math.round(t1w * 1.5);
var t2h = Math.round(t1h * 1.5);

var t2src = e.media$content[0].url+'/../../w'+t2w+'-h'+t2h+'/';

var bsrc = e.media$content[0].url;
var bw = e.media$content[0].width;
var bh = e.media$content[0].height;


photos[id] = {id:id,img:bsrc,width:bw,height:bh,
th:{src:t1src,width:t1w,height:t1h,
zoom_src:t2src,zoom_factor:1.5
}
};

}
PhotoWall.load(photos);
}
});
});
</script>

Lo rojo es lo que me interesa, lo demas es trozo del jquery que he utilizado.... lo que quiero es que coja los valores de la base de datos, en este caso IDUSER IDALBUM y el bucle for lo repita, asi no me va, no se si tengo que poner el final del echo ";} con todo el script o solo la linea que quiero que se repita... a ver si me podeis echar una mano..... 1.000 gracias!