<?php
    $gallery_images = mysqli_query_logged("SELECT * FROM gallery_images WHERE user_id = '" . get_user_id($_user) . "' LIMIT " . (($_page - 1) * 25) . ', ' . 25);
    echo '<div class="header">Graphix Completed<br /><span style="color: #cccccc; font-size: 10px;">Page: 1</span></div>';
    echo '<div class="content" style="padding: 0px 5px 5px 5px;">';
    if (mysqli_num_rows($gallery_images))
    {
        echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
        while ($gallery_images_row = mysqli_fetch_assoc($gallery_images))
        {
            $comment_count = mysqli_fetch_array(mysqli_query_logged("SELECT COUNT(*) AS num FROM images_comments WHERE link_id = '" . $gallery_images_row['image_id'] . "'"));
            echo box_image_top();
            echo '<table width="' . THUMB_WIDTH . '" height="' . THUMB_HEIGHT . '" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="top">';
            echo '<a href="?s=image&i=' . $gallery_images_row['image_id'] . '"><img src="?g=thumb&i=' . $gallery_images_row['image_id'] . '" width="' . THUMB_WIDTH . '" height="' . THUMB_HEIGHT . '" alt="" style="border: 0px;"></a><br />';
            echo '<div style="padding: 4px 0px 0px 0px;"></div>';
            echo '<b>' . $comment_count['num'] . '</b> Comments<br />';
            echo '</td></tr></table>';
            echo box_image_bottom();
        }
        echo '</td></tr></table>';
    }
    else
    {
        echo '<div style="padding: 5px 0px 0px 0px;"></div>This member has not completed any graphix...';
    }
?>