title: JQuery table pagination (MySQL + PHP)
body: <p>I'm trying to create a pagination in my JQuery table using PHP + MySQL + JQuery but I don't know how I can implement it.</p>
  
  <p>That's why I need your help, I need a simple pagination (I don't mind if it's really really simple) I just need it to work, because it's the final step in my first JQuery table.</p>
  
  <p>I'm going to post the URL of my website with the table working (without pagination at the moment, I have more than 500 entries but I only show 20 at the beginning).</p>
  
  <p>URL: <a href="http://bdebeauty.es/index.php?option=com_jumi&amp;view=application&amp;fileid=14&amp;Itemid=258" rel="nofollow">Click Here</a></p>
  
  <p>Script JQuery:</p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; 
  &lt;script&gt;
    function makeTable(data) {
        var tbl_body = "";
        $.each(data, function () {
            var tbl_row = "";
            $.each(this, function (k, v) {
                tbl_row += "&lt;td&gt;" + v + "&lt;/td&gt;";
            })
            tbl_body += "&lt;tr&gt;" + tbl_row + "&lt;/tr&gt;";
        })
  
        return tbl_body;
    }
  
    function getEmployeeFilterOptions() {
        var opts = [];
        $checkboxes.each(function () {
            if (this.checked) {
                opts.push(this.name);
            }
        });
  
        return opts;
    }
  
    function updateEmployees(opts) {
        $.ajax({
            type: "POST",
            url: "submit.php",
            dataType: 'json',
            cache: false,
            data: {
                filterOpts: opts
            },
            success: function (records) {
                $('#employees tbody').html(makeTable(records));
                // here, after the content is inside DOM/visible we activate the plugin
            }
        });
    }
  
    var $checkboxes = $("input:checkbox");
    $checkboxes.on("change", function () {
        var opts = getEmployeeFilterOptions();
        updateEmployees(opts);
    });
  
    $(document).ajaxStart(function () {
        $('#loading').fadeIn("slow");
    }).ajaxStop(function () {
        $('#loading').fadeOut("slow");
    });
  
    $(window).load(function () {
        updateEmployees();
    });
  
  &lt;/script&gt; `
  </code></pre>
  
  <p>And also here is the SQL part with PHP:</p>
  
  <pre><code>$sql = $select . $from . $where;
  
  $statement = $pdo-&gt;prepare($sql);
  $statement-&gt;execute();
  
  $results = $statement-&gt;fetchAll(PDO::FETCH_ASSOC);
  
  $json = json_encode($results);
  
  echo($json);
  </code></pre>