I am trying to use the jQuery pagination plugin with my PHP/MySQL website -- 
It appears I have to either use Ajax or use PHP to write the jQuery
pagintion header so I can control the $offset and $limit, in order to
control the pagination --

What is the best way to combine javascript, PHP and MySQL so that they can
communicate with eachother? Here is my PHP page and SQL

================================================

<script type="text/javascript" src="include/jquery-latest.js"></script>
<script type="text/javascript"
src="include/tablesorter/addons/pagination/jquery.pagination.js"></script>
<link rel="stylesheet"
href="include/tablesorter/addons/pagination/pagination.css" type="text/css"
media="print, projection, screen" />
<script type="text/javascript">
            
                function pageselectCallback(page_id, jq){
                                        $('#Searchresult').text("Showing search 
results
"+((page_id*10)+1)+"-"+((page_id*10)+10));
                }
                
        $(document).ready(function(){
                        // Create pagination element
            $("#Pagination").pagination(300, {
                                num_edge_entries: 2,
                                num_display_entries: 8,
                callback: pageselectCallback
            });
        });
            
        </script>

<div id="Pagination" class="pagination"></div>

                <br style="clear:both;" />
                <div id="Searchresult">
                        Showing search results 1-10 ...
                </div>


<?php

        $limit = 10;
        $offset = 0;

        dbConnect();
        $sql = "SELECT * FROM emt_company LIMIT $offset, $limit";
        $result = mysql_query($sql) or die(mysql_error());
        $num = mysql_num_rows($result);
        

        while($row = mysql_fetch_assoc($result)){
                
                $name = $row['name'];
                echo "$name<br>";
        
        }


?>
================================================

(sorry for posting code--- is there a [code] or [html] setting to wrap
code?)
-- 
View this message in context: 
http://www.nabble.com/jQuery-Pagination-and-MySQL-%24limit%2C-%24offset-tp21270953s27240p21270953.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to