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

if(!empty($_GET['Go']))
{
    $photo_category = $_GET['photo_category'];
    echo "<h3>". $photo_category . "</h3><br><br>";


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

        {

            $photoid=$row['id'];

            $get1 = mysql_query("SELCT * FROM `description` WHERE `pid`='$photoid'");
            if(!empty($get1))
            {
                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>
    </tr>

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

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

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

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


  </table>";

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

        }
        }}}

Please help me.

Have you heard about join optimization?. Try doing joins first and see if it will help.

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..

Are you getting any error. If So, Please show it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.