Advertisement
MBPictures

Galerie

Dec 27th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. $width = 12/$amount;
  2.             $a = 1;
  3.             $sql = mysql_query("SELECT * FROM `gallery` WHERE `show` = 'true' ORDER BY RAND() LIMIT ".$amount);
  4.            
  5.             while($out = mysql_fetch_assoc($sql) or die()){
  6.                
  7.                 if($out["title"] == ""){
  8.                     $title = "<br>";
  9.                 }
  10.                 else{
  11.                     $title = $out["title"];
  12.                 }
  13.                 ?>
  14.                 <div class="col col-<?php echo $width; ?> picture-preview">
  15.                     <div>
  16.                         <a class='fancybox' rel='group' href='gallery/<?php echo $out["src"]; ?>'>
  17.                             <!--<img src="gallery/<?php echo $out["src"]; ?>" data-thumb="gallery/<?php echo $out["src"]; ?>" id="picture-preview<?php echo $a; ?>" />-->
  18.                             <div style="background-image:url(gallery/<?php echo $out["src"]; ?>);"></div>    
  19.                         </a>
  20.                         <p>
  21.                             <?php echo $title; ?>
  22.                         </p>
  23.                     </div>
  24.                 </div>
  25.                 <?php
  26.                 $a++;  
  27.             }
  28.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement