mattennant Posted October 4, 2006 Share Posted October 4, 2006 hello therei'm trying to load a bunch of images from my database into the cache, using php and javascript. so really im trying to recreate the following bit of code, using a repeat loop.[code]<body onload="MM_preloadImages('images/uploads/ballettiff.jpg');MM_preloadImages('images/uploads/blue_silk_liberty_t047.jpg');MM_preloadImages('images/uploads/brown_spot_blouse_021.jpg')">[/code]the attempt that isn't working looks like this[code]<body onload="<?php do { ?> <?php echo "MM_preloadImages('"; ?> <?php echo $row_all_images['image']; ?> <?php echo "');"; ?> <?php } while ($row_all_images = mysql_fetch_assoc($all_images)); ?>">[/code]now i'm guessing i need to escape some characters or something, but i'm at a bit of a loss.any help much appreciated.mat Quote Link to comment Share on other sites More sharing options...
mattennant Posted October 4, 2006 Author Share Posted October 4, 2006 bump Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted October 5, 2006 Share Posted October 5, 2006 first off, you can put all your images inside that macromedia preload script -- you don't have to call it for each image. That bein said:[code=php:0]<body onLoad="MM_preloadImages(<?while($row_all_images =mysql_fetch_assoc($all_images)) $loadvar.="'images/buttons/".$row_all_images['image']."',";echo substr($loadvar,0,-1);?>);">[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.