Results 1 to 6 of 6

Thread: Ajax Pagination / MySql

  1. #1
    Join Date
    Nov 2007
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Ajax Pagination / MySql

    1) Script Title: Ajax Pagination script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...nate/index.htm

    3)Describe problem:
    Quote from the page with script demo
    This variable can be manually defined or easily dynamically written out based on information returned from the sever, such as via PHP/ MySQL.
    Where can I find this variable? I'm trying to use the Pagination script for comments from the database, but I don't know where to start.

    Any help is welcome.

    Thx in advance.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You can check out this tutorial here:
    http://www.php-mysql-tutorial.com/php-mysql-paging.php
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2007
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Thx djr33,

    I already have a backend script. I just don't know how to change the javascript variables.

    Thx anyway for your help.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    It really depends on how your backend is created, there is no "plug and play" solution. But a good start would be to first read the section "Defining "settingsvar" dynamically" on the supplimentary page. The general idea is to dynamically write out the "settings" portion of the script based on info from your backend, for example:

    PHP Code:
    <?php 

    echo "<script type='text/javascript'>\n"//Dynamically output JavaScript opening tag 
    echo "var mysettings={}\n"//Dynamically output javascript variable 
    $commentids=mysql_query("select id from comments order by date limit 5"); //get IDs to last 5 comment pages 
    $idarray=array(); 
    while (
    $theid=mysql_fetch_array($commentids)){ 
      
    array_push($idarray"'http://www.mysite.com/comments.php?id=" $theid[id] . "'"); 

    echo 
    "mysettings.page=[" implode(","$idarray) . "]\n"
    echo 
    "mysettings.selectedpage=0\n"
    echo 
    "</script>\n"//Dynamically output JavaScript closing tag 

    ?>

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    A link to your page wouldn't hurt, either.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Nov 2007
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Thank you ddadmin!!!

    I was looking for that supplimentary page, I didn't see it yesterday. That was all I needed.

    Cheers.

    Edit:
    Btw sorry for posting it in the wrong forum, I just realised that.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •