how can i keep fetch data inside the div galllery but delete buttom inside the whiel

Discussion in 'PHP' started by macaela, Sep 10, 2010.

  1. #1
    how can i keep while fetch data inside the div galllery but delete buttom inside the while fetch query but outside the div gallery
    that is because any link inside the div gallery will be automaticaly link to light jquery light box so i want the delete buttom inside while fetch but outside the div gallery

    define('ROOT_DIR', './');
    
    define('PROPER', TRUE);
    
    
    
    /**
    
    * include common files
    
    */
    
    include_once(ROOT_DIR. 'includes/common.inc.php');
    
    
    
    
    
    
    
    ?>
    
    
    
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <title>Untitled Document</title>
    
    <link href="css_eurico/lightbox.css" rel="stylesheet" type="text/css" />
    
    <link href="css_eurico/jquery.lightbox-0.5.css" rel="stylesheet" type="text/css" media="screen" />
    
    <script type="text/javascript" src="js_eurico/jquery.js"></script>
    
    <script type="text/javascript" src="js_eurico/jquery.lightbox-0.5.min.js"></script>
    
    
    
    
    
    
    
    <script type="text/javascript">
    
    
    
    $(function() {
    
    
    
    $('#gallery a').lightBox();
    
    
    
    });
    
    
    
    </script>
    
    
    
    
    
    </head>
    
    
    
    <body>
    
    
    
    <?php
    
    $album_id = $_GET['albums'];
    
     
    
    
    
    $photo = mysql_query("SELECT * FROM photos WHERE album_id='$album_id'");
    
    
    
    
    
     echo '<div id="menu">';
    
    while ($row = mysql_fetch_assoc($photo))
    
    
    
     {
    
     
    
         
    
         echo '<div id="gallery">';    
    
            echo'<div class="Image">';
    
        
    
            echo '<a href=photos/thumbs/'. $row['photo_proper'] . '  "><img class="picture" src="photos/' . $row['photo_proper'] . ' " width="100"  height="100 " /></a>';
    
            echo '<h4 class="brand">' . $row['photo_name'] . '</h4>';
    
              
    
                 
    
    
    
            echo '</div>';
    
                
    
                 echo '<a href="index.php">alo</a>';
    
        
    
    }
    
    
    
    ?>
    
    
    
     </div>
    
      </div>
    
    
    
    
    
    </body>
    
    </html>
    PHP:
     
    macaela, Sep 10, 2010 IP
  2. HungryMinds

    HungryMinds Active Member

    Messages:
    216
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #2
    Hi!

    Try This Method:

    
    $counter = 0;
    
    while ($row = mysql_fetch_assoc($photo))
    {
    	$counter = $counter+1;
    	echo '<script>';
    		echo '$(function() {';
    		echo '$("#gallery' .$counter. ' a").lightBox();';
    		echo '});';
    	echo '</script>';
    	
    	echo '<div id="gallery' . $counter . '">';    
    		echo'<div class="Image">';
    			echo '<a href=photos/thumbs/'. $row['photo_proper'] . '  "><img class="picture" src="photos/' . $row['photo_proper'] . ' " width="100"  height="100 " /></a>';
    			echo '<h4 class="brand">' . $row['photo_name'] . '</h4>';
    		echo '</div>';
    	echo '<a href="index.php">alo</a>';
    }
    
    PHP:
     
    HungryMinds, Sep 12, 2010 IP
  3. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    that didnt work still counts the delete buttom as image help please

     
    macaela, Sep 14, 2010 IP
  4. HungryMinds

    HungryMinds Active Member

    Messages:
    216
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #4
    Hi!

    Every Link Will Work For It's Gallery Div Separately To This Method.
    Because Most Times I Used This Method For JQuery Separate Linking And It Works Perfect.
    Anyway, I'll Search Any Other Method.
     
    HungryMinds, Sep 14, 2010 IP
  5. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #5
    thanks i found a solution i made this line that call the function instead calling the div gallery to call a class and i made the img link into a class image link so this way only calls that class thanks for the help nways
    $('.imagelink a').lightBox();
     
    macaela, Sep 15, 2010 IP