Hi All,
These days I'm busy with the PHP Photo Gallery Solution.
In this system Admin can upload images and its' descriptions. When user point mouse on the image, tooltip will appear. That tooltip windows contain images' description.
My problem is, Image Details are stored in photos table. And its' description stored in another table called description.
In gallery page, images will appear according to its' category. Now I have to take data from two tables and have to use two while loop.
I tried to do something but I couldnt.
Following I listed my code

    $photo_category = $_GET['photo_category'];
    echo "<h3>". $photo_category . "</h3><br><br>";

    $get = mysql_query("SELECT * FROM `photos` WHERE `category`='$photo_category'");
            while($row = mysql_fetch_array($get)){



            $get1 = mysql_query("SELCT * FROM `description` WHERE `pid`='$photoid'");
                while($row2 = mysql_fetch_array($get1))

    echo '<div id="main_item"> 
             <div class="new_mark"></div>';
    echo '<div id="item_img"><a href="'.$row['link'].'" class="zoom"><img src="photo/'.$row['link'].'" id="img_pen"/></a></div>';
    echo '<div id="item_dis">
            <div class="your_selector">
                          More  <br/>
    echo '<div class="tooltip_description" style="display:none;" title="'.$row[1].'">';

    echo "
    <table id='tool_dis_td' border='0' style='padding:0px; margin:0px'>

    <tr height='5'>
    <td colspan='2'> <p id='top_head'>Gemstone Information</p> </td>

    <td width='140'> Type : </td>
    <td width='260'> ".$row[4]." </td>

    <td> Colour : </td>
    <td> ".$row[5]." </td>

    <td> Origin : </td>
    <td> ".$row[6]." </td>

    <td> App. Carat Weight : </td>
    <td> ".$row[7]." </td>


    echo '</div></div><a href="contact.php"><div class="order_click"> Order Now</div></a></div></div>';


Please help me.

3 Years
Discussion Span
Last Post by rpv_sen

Have you heard about join optimization?. Try doing joins first and see if it will help.
Can you explain me with an example please?


you can read a good tutorial here. Please let me know if it help.

I can write you the codes, but I am in middle of doing very important projects right now. Maybe later,I'll have to see..

Edited by veedeoo: more info added

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.