如何在几个特定大小的窗口中显示多个图像,在php中用选项卡分隔

如何在几个特定大小的窗口中显示多个图像,在php中用选项卡分隔,php,jquery,emoticons,Php,Jquery,Emoticons,在我的数据库查询中,它返回一组图像名称。我想在一个小窗口中显示它们(比如3x3),如果有更多图像(>9),它将通过选项卡或特定符号填充到下一个窗口。人们可以单击该符号打开下一个窗口。我还想识别用户选择的图像 在这幅图中,显示的想法类似于表情符号窗口 你知道我可以用php制作吗 以下是我正在尝试的内容,请随时更正我的代码: <?php include "dbConnector.php" ; ?> <table> <tr> <?php require_on

在我的数据库查询中,它返回一组图像名称。我想在一个小窗口中显示它们(比如3x3),如果有更多图像(>9),它将通过选项卡或特定符号填充到下一个窗口。人们可以单击该符号打开下一个窗口。我还想识别用户选择的图像

在这幅图中,显示的想法类似于表情符号窗口

你知道我可以用php制作吗

以下是我正在尝试的内容,请随时更正我的代码:

<?php include "dbConnector.php" ; ?>
<table>
<tr>
<?php
require_once ("paginator.php");
$pages = new Paginator; //ew paginator object to play with and initializes the default values behind the scenes
$connector= new DbConnector();
$queryObj = mysql_query("SELECT COUNT(*) FROM `mydb`.`images`"); 
$num_rows = mysql_num_rows($queryObj);
$pages->items_total = $num_rows; //assigns total number of records to our paginator's items_total property
$pages->mid_range = 7;//number of page links to display.
$pages->paginate();//ell the paginator to get to work and paginate 

$x = mysql_query( "SELECT * FROM `mydb`.`images` ORDER BY `name` DESC $pages->limit");
$i = 0;
while($row = mysql_fetch_assoc($x)) 
{ 
    $i++;
    echo "<td><img src='imagefolder/".$row['name'].".png'/></td>";
    if ($i % 3 == 0) {
           echo '</tr><tr>';}

}
echo "Page $pages->current_page of $pages->num_pages";
echo $pages->display_pages();//displays our page numbers
?>
</tr>
<table>


这里对分页类进行了修改,以删除这些错误,并将
DBConnector
替换为my
DBEngine

您缺少的一个元素是每页限制和下一页>上一页链接

<?php

    error_reporting(E_ALL);
    class Paginator
        {
            var $items_per_page;
            var $items_total;
            var $current_page;
            var $num_pages;
            var $mid_range;
            var $low;
            var $high;
            var $limit;
            var $return;
            var $default_ipp = 25;

            function Paginator($_staticipp = '')
                {
                    $this->current_page     =   (!isset($_GET['page']) || (isset($_GET['page']) && !is_numeric($_GET['page'])))? 1:$_GET['page'];
                    $this->mid_range        =   7;
                    $_GET['ipp']            =   (!empty($_staticipp) && is_numeric($_staticipp))? $_staticipp: $_GET['ipp'];
                    $this->items_per_page   =   (!empty($_GET['ipp']) && is_numeric($_GET['ipp'])) ? $_GET['ipp']:$this->default_ipp;
                }

            function paginate()
                {           
                    if(isset($_GET['ipp']) && $_GET['ipp'] == 'All') {
                            $this->num_pages        =   ceil($this->items_total/$this->default_ipp);
                            $this->items_per_page   =   $this->default_ipp;
                        }
                    else {
                            if(!is_numeric($this->items_per_page) || $this->items_per_page <= 0)
                                $this->items_per_page = $this->default_ipp;

                            $this->num_pages = ceil($this->items_total / $this->items_per_page);
                        }

                    $this->current_page =   (isset($_GET['page']) && is_numeric($_GET['page']))? (int) $_GET['page']:0; // must be numeric > 0
                    if($this->current_page < 1 Or !is_numeric($this->current_page)) $this->current_page = 1;
                    if($this->current_page > $this->num_pages) $this->current_page = $this->num_pages;
                    $prev_page          =   $this->current_page-1;
                    $next_page          =   $this->current_page+1;

                    if($this->num_pages > 10) {
                            $this->return = ($this->current_page != 1 And $this->items_total >= 10) ? "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$prev_page&ipp=$this->items_per_page\">« Previous</a> ":"<span class=\"inactive\" href=\"#\">« Previous</span> ";

                            $this->start_range = $this->current_page - floor($this->mid_range/2);
                            $this->end_range = $this->current_page + floor($this->mid_range/2);

                            if($this->start_range <= 0) {
                                    $this->end_range += abs($this->start_range)+1;
                                    $this->start_range = 1;
                                }

                            if($this->end_range > $this->num_pages) {
                                    $this->start_range -= $this->end_range-$this->num_pages;
                                    $this->end_range = $this->num_pages;
                                }

                            $this->range = range($this->start_range,$this->end_range);

                            for($i=1;$i<=$this->num_pages;$i++) {
                                    if($this->range[0] > 2 And $i == $this->range[0]) $this->return .= " ... ";
                                    // loop through all pages. if first, last, or in range, display
                                    if($i == 1 Or $i == $this->num_pages Or in_array($i,$this->range)) {
                                            $this->return .= ($i == $this->current_page And $_GET['page'] != 'All') ? "<a title=\"Go to page $i of $this->num_pages\" class=\"current\" href=\"#\">$i</a> ":"<a class=\"paginate\" title=\"Go to page $i of $this->num_pages\" href=\"$_SERVER[PHP_SELF]?page=$i&ipp=$this->items_per_page\">$i</a> ";
                                        }

                                    if($this->range[$this->mid_range-1] < $this->num_pages-1 And $i == $this->range[$this->mid_range-1]) $this->return .= " ... ";
                                }

                            $this->return .= (($this->current_page != $this->num_pages And $this->items_total >= 10) And ($_GET['page'] != 'All')) ? "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$next_page&ipp=$this->items_per_page\">Next »</a>\n":"<span class=\"inactive\" href=\"#\">» Next</span>\n";
                            $this->return .= ($_GET['page'] == 'All') ? "<a class=\"current\" style=\"margin-left:10px\" href=\"#\">All</a> \n":"<a class=\"paginate\" style=\"margin-left:10px\" href=\"$_SERVER[PHP_SELF]?page=1&ipp=All\">All</a> \n";
                        }
                    else {
                            for($i=1;$i<=$this->num_pages;$i++) {
                                    $this->return .= ($i == $this->current_page) ? "<a class=\"current\" href=\"#\">$i</a> ":"<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$i&ipp=$this->items_per_page\">$i</a> ";
                                }

                            $this->return .= "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=1&ipp=All\">All</a> \n";
                        }

                    $this->low = ($this->current_page-1) * $this->items_per_page;
                    $this->high = (isset($_GET['ipp']) && $_GET['ipp'] == 'All') ? $this->items_total:($this->current_page * $this->items_per_page)-1;
                    $this->limit = (isset($_GET['ipp']) && $_GET['ipp'] == 'All') ? "":" LIMIT ".$this->low.",".$this->items_per_page;
                }

            function display_items_per_page()
                {
                    $items = '';
                    $ipp_array = array("",9,'All');
                    foreach($ipp_array as $ipp_opt)    $items .= ($ipp_opt == $this->items_per_page) ? "<option selected value=\"$ipp_opt\">$ipp_opt</option>\n":"<option value=\"$ipp_opt\">$ipp_opt</option>\n";
                    return "<span class=\"paginate\">Items per page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page=1&ipp='+this[this.selectedIndex].value;return false\">$items</select>\n";
                }

            function display_jump_menu()
                {
                    for($i=1;$i<=$this->num_pages;$i++) {
                            $option .= ($i==$this->current_page) ? "<option value=\"$i\" selected>$i</option>\n":"<option value=\"$i\">$i</option>\n";
                        }

                    return "<span class=\"paginate\">Page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page='+this[this.selectedIndex].value+'&ipp=$this->items_per_page';return false\">$option</select>\n";
                }

            function display_pages()
                {
                    return $this->return;
                }
        }

    class DBEngine
        {
            protected   $con;
            // Create a default database element
            public  function __construct($host = '',$db = '',$user = '',$pass = '')
                {
                    try {
                            $this->con  =   new PDO("mysql:host=$host;dbname=$db",$user,$pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
                        }
                    catch (Exception $e) {
                          return 0;
                        }
                }

            // Simple fetch and return method
            public  function Fetch($_sql)
                {
                    $query  =   $this->con->prepare($_sql);
                    $query->execute();

                    if($query->rowCount() > 0) {
                            while($array = $query->fetch(PDO::FETCH_ASSOC)) {
                                    $rows[]   =   $array;
                                }
                        }

                    return (isset($rows) && $rows !== 0 && !empty($rows))? $rows: 0;
                }

            // Simple write to db method
            public  function Write($_sql)
                {
                    $query  =   $this->con->prepare($_sql);
                    $query->execute();
                }
        } ?>

    <table>
        <tr>
            <?php
            $con                =   new DBEngine("host","database","user","pass");
            $pages              =   new Paginator(9);
            $queryObj           =   $con->Fetch("SELECT COUNT(*) FROM mydb.images"); 
            $num_rows           =   $queryObj[0]['COUNT(*)'];

            $pages->items_total = $num_rows; //assigns total number of records to our paginator's items_total property
            $pages->mid_range   = 7;//number of page links to display.
            $pages->paginate();//tell the paginator to get to work and paginate  ?>
            <tr>
                <td colspan="3"><?php echo $pages->display_items_per_page(); ?></td>
            </tr>
            <tr>
            <?php
            $_sql               =   "SELECT * FROM mydb.images ORDER BY `name` DESC ".$pages->limit;
            $x                  =   $con->Fetch($_sql);
            $i                  =   1;
            foreach($x as $val => $row) { ?>
                    <td style="border:1px solid;"><img src="<?php echo $row['name']; ?>" style="max-width: 40px;" /></td>
                    <?php
                    if ($i % 3 == 0) { ?>
                </tr>
                <tr><?php
                        }
                        $i++;
                } ?>

            Page <?php echo $pages->current_page; ?> of <?php echo $pages->num_pages; ?>
            <?php echo $pages->display_pages();//displays our page numbers ?>
        </tr>
    <table>

听起来分页是您尝试做的最难的部分:是的,这也是我需要知道的一个元素!谢谢我也不知道如何在一个固定大小的窗口中填充图像,并识别所选的窗口,然后隐藏窗口并显示所选的图像。而且每次查询的图像数量将不同,因此,页面数量也不同。有没有可能让paginate方法自动计算每个窗口的固定项目数?你能给我一段示例代码,让我接受它作为解决方案?谢谢当然,把你目前所拥有的东西拿出来,我可以尽我所能帮助你。我为您提供了分页链接,因此我假设您只需要在页面上设置固定宽度的帮助??我在使用DBEngine而不是dbConnector时遇到了一些困难。当我在里面替换我的db名称时,我仍然会遇到一些错误,所以我尝试将我的dbconnector与您的代码一起使用OK,现在我可以让它运行,而不必注意上面提到的ipp和页面。但它在一个页面上显示所有图像,有3列,但有许多行。实际上我想要一个3x3的窗口。接下来的9张图片将出现在下一个窗口中,以此类推……您是否限制每页仅显示9张图片?我在一个页面中获得了所有12幅图像,在页面链接按钮中显示“第0页,共0页”。另一件事是,当我将我的信息添加到您的代码中时,我还收到警告“表'mydb.mydb.images'在C:\xampp\htdocs\…”中不存在,不确定原因。这就是我的表:是的,它工作!!是否可以设置每页的默认项目数(不允许用户选择)。我不知道页面链接显示的是这样的“第1页,共12页”(我总共有12张图片,看起来它也显示在那里)。这是否可以使其显示(使用“上一步”和“下一步”按钮)而不是上面的按钮?你有一段很好的代码!
<?php

class Paginator{
    var $items_per_page;
    var $items_total;
    var $current_page;
    var $num_pages;
    var $mid_range;
    var $low;
    var $high;
    var $limit;
    var $return;
    var $default_ipp = 25;

    function Paginator()
    {
        $this->current_page = 1;
        $this->mid_range = 7;
        $this->items_per_page = (!empty($_GET['ipp'])) ? $_GET['ipp']:$this->default_ipp;
    }

    function paginate()
    {
        if($_GET['ipp'] == 'All')
        {
            $this->num_pages = ceil($this->items_total/$this->default_ipp);
            $this->items_per_page = $this->default_ipp;
        }
        else
        {
            if(!is_numeric($this->items_per_page) OR $this->items_per_page <= 0) $this->items_per_page = $this->default_ipp;
            $this->num_pages = ceil($this->items_total/$this->items_per_page);
        }
        $this->current_page = (int) $_GET['page']; // must be numeric > 0
        if($this->current_page < 1 Or !is_numeric($this->current_page)) $this->current_page = 1;
        if($this->current_page > $this->num_pages) $this->current_page = $this->num_pages;
        $prev_page = $this->current_page-1;
        $next_page = $this->current_page+1;

        if($this->num_pages > 10)
        {
            $this->return = ($this->current_page != 1 And $this->items_total >= 10) ? "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$prev_page&ipp=$this->items_per_page\">« Previous</a> ":"<span class=\"inactive\" href=\"#\">« Previous</span> ";

            $this->start_range = $this->current_page - floor($this->mid_range/2);
            $this->end_range = $this->current_page + floor($this->mid_range/2);

            if($this->start_range <= 0)
            {
                $this->end_range += abs($this->start_range)+1;
                $this->start_range = 1;
            }
            if($this->end_range > $this->num_pages)
            {
                $this->start_range -= $this->end_range-$this->num_pages;
                $this->end_range = $this->num_pages;
            }
            $this->range = range($this->start_range,$this->end_range);

            for($i=1;$i<=$this->num_pages;$i++)
            {
                if($this->range[0] > 2 And $i == $this->range[0]) $this->return .= " ... ";
                // loop through all pages. if first, last, or in range, display
                if($i==1 Or $i==$this->num_pages Or in_array($i,$this->range))
                {
                    $this->return .= ($i == $this->current_page And $_GET['page'] != 'All') ? "<a title=\"Go to page $i of $this->num_pages\" class=\"current\" href=\"#\">$i</a> ":"<a class=\"paginate\" title=\"Go to page $i of $this->num_pages\" href=\"$_SERVER[PHP_SELF]?page=$i&ipp=$this->items_per_page\">$i</a> ";
                }
                if($this->range[$this->mid_range-1] < $this->num_pages-1 And $i == $this->range[$this->mid_range-1]) $this->return .= " ... ";
            }
            $this->return .= (($this->current_page != $this->num_pages And $this->items_total >= 10) And ($_GET['page'] != 'All')) ? "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$next_page&ipp=$this->items_per_page\">Next »</a>\n":"<span class=\"inactive\" href=\"#\">» Next</span>\n";
            $this->return .= ($_GET['page'] == 'All') ? "<a class=\"current\" style=\"margin-left:10px\" href=\"#\">All</a> \n":"<a class=\"paginate\" style=\"margin-left:10px\" href=\"$_SERVER[PHP_SELF]?page=1&ipp=All\">All</a> \n";
        }
        else
        {
            for($i=1;$i<=$this->num_pages;$i++)
            {
                $this->return .= ($i == $this->current_page) ? "<a class=\"current\" href=\"#\">$i</a> ":"<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$i&ipp=$this->items_per_page\">$i</a> ";
            }
            $this->return .= "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=1&ipp=All\">All</a> \n";
        }
        $this->low = ($this->current_page-1) * $this->items_per_page;
        $this->high = ($_GET['ipp'] == 'All') ? $this->items_total:($this->current_page * $this->items_per_page)-1;
        $this->limit = ($_GET['ipp'] == 'All') ? "":" LIMIT $this->low,$this->items_per_page";
    }

    function display_items_per_page()
    {
        $items = '';
        $ipp_array = array(10,25,50,100,'All');
        foreach($ipp_array as $ipp_opt)    $items .= ($ipp_opt == $this->items_per_page) ? "<option selected value=\"$ipp_opt\">$ipp_opt</option>\n":"<option value=\"$ipp_opt\">$ipp_opt</option>\n";
        return "<span class=\"paginate\">Items per page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page=1&ipp='+this[this.selectedIndex].value;return false\">$items</select>\n";
    }

    function display_jump_menu()
    {
        for($i=1;$i<=$this->num_pages;$i++)
        {
            $option .= ($i==$this->current_page) ? "<option value=\"$i\" selected>$i</option>\n":"<option value=\"$i\">$i</option>\n";
        }
        return "<span class=\"paginate\">Page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page='+this[this.selectedIndex].value+'&ipp=$this->items_per_page';return false\">$option</select>\n";
    }

    function display_pages()
    {
        return $this->return;
    }
}
?>
<?php

    error_reporting(E_ALL);
    class Paginator
        {
            var $items_per_page;
            var $items_total;
            var $current_page;
            var $num_pages;
            var $mid_range;
            var $low;
            var $high;
            var $limit;
            var $return;
            var $default_ipp = 25;

            function Paginator($_staticipp = '')
                {
                    $this->current_page     =   (!isset($_GET['page']) || (isset($_GET['page']) && !is_numeric($_GET['page'])))? 1:$_GET['page'];
                    $this->mid_range        =   7;
                    $_GET['ipp']            =   (!empty($_staticipp) && is_numeric($_staticipp))? $_staticipp: $_GET['ipp'];
                    $this->items_per_page   =   (!empty($_GET['ipp']) && is_numeric($_GET['ipp'])) ? $_GET['ipp']:$this->default_ipp;
                }

            function paginate()
                {           
                    if(isset($_GET['ipp']) && $_GET['ipp'] == 'All') {
                            $this->num_pages        =   ceil($this->items_total/$this->default_ipp);
                            $this->items_per_page   =   $this->default_ipp;
                        }
                    else {
                            if(!is_numeric($this->items_per_page) || $this->items_per_page <= 0)
                                $this->items_per_page = $this->default_ipp;

                            $this->num_pages = ceil($this->items_total / $this->items_per_page);
                        }

                    $this->current_page =   (isset($_GET['page']) && is_numeric($_GET['page']))? (int) $_GET['page']:0; // must be numeric > 0
                    if($this->current_page < 1 Or !is_numeric($this->current_page)) $this->current_page = 1;
                    if($this->current_page > $this->num_pages) $this->current_page = $this->num_pages;
                    $prev_page          =   $this->current_page-1;
                    $next_page          =   $this->current_page+1;

                    if($this->num_pages > 10) {
                            $this->return = ($this->current_page != 1 And $this->items_total >= 10) ? "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$prev_page&ipp=$this->items_per_page\">« Previous</a> ":"<span class=\"inactive\" href=\"#\">« Previous</span> ";

                            $this->start_range = $this->current_page - floor($this->mid_range/2);
                            $this->end_range = $this->current_page + floor($this->mid_range/2);

                            if($this->start_range <= 0) {
                                    $this->end_range += abs($this->start_range)+1;
                                    $this->start_range = 1;
                                }

                            if($this->end_range > $this->num_pages) {
                                    $this->start_range -= $this->end_range-$this->num_pages;
                                    $this->end_range = $this->num_pages;
                                }

                            $this->range = range($this->start_range,$this->end_range);

                            for($i=1;$i<=$this->num_pages;$i++) {
                                    if($this->range[0] > 2 And $i == $this->range[0]) $this->return .= " ... ";
                                    // loop through all pages. if first, last, or in range, display
                                    if($i == 1 Or $i == $this->num_pages Or in_array($i,$this->range)) {
                                            $this->return .= ($i == $this->current_page And $_GET['page'] != 'All') ? "<a title=\"Go to page $i of $this->num_pages\" class=\"current\" href=\"#\">$i</a> ":"<a class=\"paginate\" title=\"Go to page $i of $this->num_pages\" href=\"$_SERVER[PHP_SELF]?page=$i&ipp=$this->items_per_page\">$i</a> ";
                                        }

                                    if($this->range[$this->mid_range-1] < $this->num_pages-1 And $i == $this->range[$this->mid_range-1]) $this->return .= " ... ";
                                }

                            $this->return .= (($this->current_page != $this->num_pages And $this->items_total >= 10) And ($_GET['page'] != 'All')) ? "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$next_page&ipp=$this->items_per_page\">Next »</a>\n":"<span class=\"inactive\" href=\"#\">» Next</span>\n";
                            $this->return .= ($_GET['page'] == 'All') ? "<a class=\"current\" style=\"margin-left:10px\" href=\"#\">All</a> \n":"<a class=\"paginate\" style=\"margin-left:10px\" href=\"$_SERVER[PHP_SELF]?page=1&ipp=All\">All</a> \n";
                        }
                    else {
                            for($i=1;$i<=$this->num_pages;$i++) {
                                    $this->return .= ($i == $this->current_page) ? "<a class=\"current\" href=\"#\">$i</a> ":"<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=$i&ipp=$this->items_per_page\">$i</a> ";
                                }

                            $this->return .= "<a class=\"paginate\" href=\"$_SERVER[PHP_SELF]?page=1&ipp=All\">All</a> \n";
                        }

                    $this->low = ($this->current_page-1) * $this->items_per_page;
                    $this->high = (isset($_GET['ipp']) && $_GET['ipp'] == 'All') ? $this->items_total:($this->current_page * $this->items_per_page)-1;
                    $this->limit = (isset($_GET['ipp']) && $_GET['ipp'] == 'All') ? "":" LIMIT ".$this->low.",".$this->items_per_page;
                }

            function display_items_per_page()
                {
                    $items = '';
                    $ipp_array = array("",9,'All');
                    foreach($ipp_array as $ipp_opt)    $items .= ($ipp_opt == $this->items_per_page) ? "<option selected value=\"$ipp_opt\">$ipp_opt</option>\n":"<option value=\"$ipp_opt\">$ipp_opt</option>\n";
                    return "<span class=\"paginate\">Items per page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page=1&ipp='+this[this.selectedIndex].value;return false\">$items</select>\n";
                }

            function display_jump_menu()
                {
                    for($i=1;$i<=$this->num_pages;$i++) {
                            $option .= ($i==$this->current_page) ? "<option value=\"$i\" selected>$i</option>\n":"<option value=\"$i\">$i</option>\n";
                        }

                    return "<span class=\"paginate\">Page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page='+this[this.selectedIndex].value+'&ipp=$this->items_per_page';return false\">$option</select>\n";
                }

            function display_pages()
                {
                    return $this->return;
                }
        }

    class DBEngine
        {
            protected   $con;
            // Create a default database element
            public  function __construct($host = '',$db = '',$user = '',$pass = '')
                {
                    try {
                            $this->con  =   new PDO("mysql:host=$host;dbname=$db",$user,$pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
                        }
                    catch (Exception $e) {
                          return 0;
                        }
                }

            // Simple fetch and return method
            public  function Fetch($_sql)
                {
                    $query  =   $this->con->prepare($_sql);
                    $query->execute();

                    if($query->rowCount() > 0) {
                            while($array = $query->fetch(PDO::FETCH_ASSOC)) {
                                    $rows[]   =   $array;
                                }
                        }

                    return (isset($rows) && $rows !== 0 && !empty($rows))? $rows: 0;
                }

            // Simple write to db method
            public  function Write($_sql)
                {
                    $query  =   $this->con->prepare($_sql);
                    $query->execute();
                }
        } ?>

    <table>
        <tr>
            <?php
            $con                =   new DBEngine("host","database","user","pass");
            $pages              =   new Paginator(9);
            $queryObj           =   $con->Fetch("SELECT COUNT(*) FROM mydb.images"); 
            $num_rows           =   $queryObj[0]['COUNT(*)'];

            $pages->items_total = $num_rows; //assigns total number of records to our paginator's items_total property
            $pages->mid_range   = 7;//number of page links to display.
            $pages->paginate();//tell the paginator to get to work and paginate  ?>
            <tr>
                <td colspan="3"><?php echo $pages->display_items_per_page(); ?></td>
            </tr>
            <tr>
            <?php
            $_sql               =   "SELECT * FROM mydb.images ORDER BY `name` DESC ".$pages->limit;
            $x                  =   $con->Fetch($_sql);
            $i                  =   1;
            foreach($x as $val => $row) { ?>
                    <td style="border:1px solid;"><img src="<?php echo $row['name']; ?>" style="max-width: 40px;" /></td>
                    <?php
                    if ($i % 3 == 0) { ?>
                </tr>
                <tr><?php
                        }
                        $i++;
                } ?>

            Page <?php echo $pages->current_page; ?> of <?php echo $pages->num_pages; ?>
            <?php echo $pages->display_pages();//displays our page numbers ?>
        </tr>
    <table>