i don't know how or even if it is possible have this code work peginated. right now all the data comes in one page but it would be nice to have it in multiple pages let say 40 per page

would you be able to help? i know it is a lot to ask but i cannot pay someone now to do it.

many thanks

function viewallusers_run_action_user_template() {
        switch ($_GET['action']) {
            case 'addon_viewallusers_showpage1':
            $data = viewallusers_display_addon_page();
            break;
            default:
            $data = '';
            break;
        } // End switch ($_GET['action'])
        return $data;
    }
     
    /**
    * run_action_admin_template()
    * This function handles administrative $_GET[] actions related to the addon. Function must be named using this method: addon_addonname_description.
    * @return string Should return all contents that should be displayed when a addon specific $_GET['action'] is called.
    **/
    function viewallusers_run_action_admin_template() {
    }
     
    /**
    * run_template_user_fields()
    * This function handles all the replacement of {template_tags} with the actual content. All tags setup here must also be added to teh load_template function in order for open-realty to parse them.
    * @param string $tag
    * @return string Should return all contents that should be displayed when a addon specific $tag is called.
    **/
    function viewallusers_run_template_user_fields($tag = '') {
        switch ($tag) {
            case 'addon_viewallusers_link':
            $data = viewallusers_display_addon_link();
            break;
            default:
            $data = '';
            break;
        } // End switch ($_GET['action'])
        return $data;
    }
     
    // Addon Specific Function
    function viewallusers_display_addon_link() {
        // Show the link for the menu
        $display = '<a href="index.php?action=addon_viewallusers_showpage1">View All Agents</a>';
        return $display;
    }
     
    function viewallusers_display_addon_page() {
        // display all the users in columns, pictures and names
        global $conn, $lang, $config, $style;
        require_once($config['basepath'].'/include/misc.inc.php');
        $misc = new misc();
        $display = '<table border="1" cellspacing="10" cellpadding="3" width="$style[admin_table_width]" class="form_main" align="center">';
        $var_reset = 1; // Reset the var (counter) (DO NOT CHANGE)
        // How Many To show Per Row
        $user_col_max = 4; // Change this to suit your needs
         
        // pull the user information from the table
        $sql = "SELECT userdb_user_name, userdb_id, userdb_user_first_name, userdb_user_last_name FROM " . $config[table_prefix] . "userdb where userdb_is_agent = 'yes' order by userdb_user_name";
        $recordSet1 = $conn->Execute($sql);
        if ($recordSet1 === false) {
            $misc->log_error($sql);
        }
        while (!$recordSet1->EOF) {
            // loop through our users
            $name = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_name]);
            $first = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_first_name]);
            $last = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_last_name]);
            $userID = $misc->make_db_unsafe ($recordSet1->fields[userdb_id]);
            if ($var_reset == 0) {
                $display .= "<tr>";
            }
            $display .= "<td align=\"center\" valign=\"top\"><a href=\"$config[baseurl]/index.php?action=view_user&user=$userID\">";
             
            // get our image data using the userid
            $user = $misc->make_db_unsafe($userID);
            $sql = "SELECT userimages_id, userimages_caption, userimages_file_name, userimages_thumb_file_name FROM " . $config[table_prefix] . "userimages WHERE (userdb_id = $user) ";
            $recordSet = $conn->SelectLimit($sql, 1, 0 );
            if ($recordSet === false) {
                $misc->log_error($sql);
            }
            $num_images = $recordSet->RecordCount();
            if ($num_images > 0) {
               // while (!$recordSet->EOF) {
                    $caption = $misc->make_db_unsafe ($recordSet->fields[userimages_caption]);
                    $thumb_file_name = $misc->make_db_unsafe ($recordSet->fields[userimages_thumb_file_name] );
                    $file_name = $misc->make_db_unsafe ($recordSet->fields[userimages_file_name]);
                    $imageID = $misc->make_db_unsafe ($recordSet->fields[userimages_id]);
                    $imagedata = GetImageSize("$config[user_upload_path]/$thumb_file_name" );
                    $imagewidth = $imagedata[0];
                    $imageheight = $imagedata[1];
                    $shrinkage = $config[thumbnail_width]/$imagewidth;
                    $displaywidth = $imagewidth * $shrinkage;
                    $displayheight = $imageheight * $shrinkage;
                    $display .= "<img src=\"$config[user_view_images_path]/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\"><br> ";
                   // $recordSet->MoveNext();
               // }
            } else {
                $display .= "<img src=\"images/nophoto_1.gif\"><br>";
            }
             
            $display .= "<br>$first $last</a><br>";
            $display .= "</td>";
             
            if ($var_reset == $user_col_max) {
                $display .= "</tr>";
                $var_reset = 1;
            } else {
                $var_reset++;
            }
            $recordSet1->MoveNext();
        } // end While loop
        $display .= "</td></table><br>";
        return $display;
    } // end viewallusers_display_addon_page

Fairly simple, limit the number of results that SQL returns, and have a start point for the query. A google search brings up what you want.
Click me.

Fairly simple, limit the number of results that SQL returns, and have a start point for the query. A google search brings up what you want.
Click me.

thank you for taking your time to point me to right direction.
i did google and tried to do it in the past many many many times but i just don't understand it completely. some does not say where i should locate the file some does not tell me what i should replace the information with and etc. and i am sure for people like you who understand the programing make much more sense then me.

thank you

<?php
$LIMIT = 40;// Entries Per Page
If (isset($_GET[‘page’])) {
  // Get Current page from URL
  $page = $_GET[‘page’];
  If ($page <= 0) {
    $page = 1;     // Page is less than 0 then set it to 1
  }
} else {
  $page = 1;  // URL does not show the page set it to 1
}
$strqry = “select id from MyTable”; // Create MySQL Query String
$query = mysql_query($strqry) or die("MySQL Error: <br /> {$strqry} <br />", mysql_error());
$TOTALROWS=mysql_num_rows($query);// Get number of rows returned
$NumOfPages = $TOTALROWS / $LIMIT; // Figure out how many pages there should be based on your $LIMIT
$LimitValue = $page * $LIMIT – ($LIMIT);// This is for your MySQL Query to limit the entries per page
?>
<div id="paginating" align="right">Pages:
<?php
If ($page == ceil($NumOfPages) &amp;&amp; $page != 1) {
// Check to make sure we’re not on page 1 or Total number of pages is not 1
 for($i = 1; $i <= ceil($NumOfPages)-1; $i++) {
 // Loop through the number of total pages
  if($i > 0) {
  // if $i greater than 0 display it as a hyperlink
   echo "<a href=\"/{$i}\">{$i}</a>";
  }
 }
}
If ($page == ceil($NumOfPages) ) { $startPage = $page; } else { $startPage = 1; }
for ($i = $startPage; $i <= $page+6; $i++) {
 if ($i <= ceil($NumOfPages)) {
 // $page is not the last page
  if($i == $page) {
  // $page is current page
   echo " [{$i}] "; } else {
    // Not the current page Hyperlink them
    echo "<a href="\"/{$i}\">{$i}</a> ";
   }
  }
 }
?>
</div>

the logic may be wrong or overly complex, but in my limited test it ran, this came from the first 'how to paginate php tutorial' google result

hi, again thank you for trying to help me, what do i do with this code, where do i put it?

thank you very much.

No
This code, that works,
came from the first result google search for 'php pagination tutorial'
If you cannot understand the tutorials you need to read and learn a bit before you continue.

No
This code, that works,
came from the first result google search for 'php pagination tutorial'
If you cannot understand the tutorials you need to read and learn a bit before you continue.

dammit, too late to edit
read my own post and there is some missing

left off ....

The tutorial I looked through included a section in integrating the tutorial into your existing script

i have been looking for those tutorials but i still don't understand how to make it work with my existing site.

I was hoping, i know it is a lot to ask, that someone to tell me how i could make it work.

thank you

This code in function viewallusers_display_addon_page()

$sql = "SELECT userdb_user_name, userdb_id, userdb_user_first_name, userdb_user_last_name FROM " . $config[table_prefix] . "userdb where userdb_is_agent = 'yes' order by userdb_user_name";

selects the entire db and outputs it
so it should go somewhere just above there
and

$sql = "SELECT userdb_user_name, userdb_id, userdb_user_first_name, userdb_user_last_name FROM " . $config[table_prefix] . "userdb where userdb_is_agent = 'yes' order by userdb_user_name limit ". $limit." offset ".($limit * $page);

and the selector "id" in the tutorial script be the unique id column

I really don't know how it will work,
as long as the testing isnt done on your production server, you can hash with it until it works right

i did something like this i add the code you provided down there you can see, but i get an error saying

Parse error: syntax error, unexpected T_STRING in

in this line

$strqry = “select id from MyTable”; // Create MySQL Query String
function viewallusers_run_action_user_template() {
        switch ($_GET['action']) {
            case 'addon_viewallusers_showpage1':
            $data = viewallusers_display_addon_page();
            break;
            default:
            $data = '';
            break;
        } // End switch ($_GET['action'])
        return $data;
    }
     
    /**
    * run_action_admin_template()
    * This function handles administrative $_GET[] actions related to the addon. Function must be named using this method: addon_addonname_description.
    * @return string Should return all contents that should be displayed when a addon specific $_GET['action'] is called.
    **/
    function viewallusers_run_action_admin_template() {
    }
     
    /**
    * run_template_user_fields()
    * This function handles all the replacement of {template_tags} with the actual content. All tags setup here must also be added to teh load_template function in order for open-realty to parse them.
    * @param string $tag
    * @return string Should return all contents that should be displayed when a addon specific $tag is called.
    **/
    function viewallusers_run_template_user_fields($tag = '') {
        switch ($tag) {
            case 'addon_viewallusers_link':
            $data = viewallusers_display_addon_link();
            break;
            default:
            $data = '';
            break;
        } // End switch ($_GET['action'])
        return $data;
    }
     
    // Addon Specific Function
    function viewallusers_display_addon_link() {
        // Show the link for the menu
        $display = '<a href="index.php?action=addon_viewallusers_showpage1">View All Agents</a>';
        return $display;
    }
     
    function viewallusers_display_addon_page() {
        // display all the users in columns, pictures and names
        global $conn, $lang, $config, $style;
        require_once($config['basepath'].'/include/misc.inc.php');
        $misc = new misc();
        $display = '<table border="1" cellspacing="10" cellpadding="3" width="$style[admin_table_width]" class="form_main" align="center">';
        $var_reset = 1; // Reset the var (counter) (DO NOT CHANGE)
        // How Many To show Per Row
        $user_col_max = 4; // Change this to suit your needs
        



$LIMIT = 40;// Entries Per Page
If (isset($_GET[‘page’])) {
  // Get Current page from URL
  $page = $_GET[‘page’];
  If ($page <= 0) {
    $page = 1;     // Page is less than 0 then set it to 1
  }
} else {
  $page = 1;  // URL does not show the page set it to 1
}
$strqry = “select id from MyTable”; // Create MySQL Query String
$query = mysql_query($strqry) or die("MySQL Error: <br /> {$strqry} <br />", mysql_error());
$TOTALROWS=mysql_num_rows($query);// Get number of rows returned
$NumOfPages = $TOTALROWS / $LIMIT; // Figure out how many pages there should be based on your $LIMIT
$LimitValue = $page * $LIMIT – ($LIMIT);// This is for your MySQL Query to limit the entries per page
?>
<div id="paginating" align="right">Pages:
<?php
If ($page == ceil($NumOfPages) &amp;&amp; $page != 1) {
// Check to make sure we’re not on page 1 or Total number of pages is not 1
 for($i = 1; $i <= ceil($NumOfPages)-1; $i++) {
 // Loop through the number of total pages
  if($i > 0) {
  // if $i greater than 0 display it as a hyperlink
   echo "<a href=\"/{$i}\">{$i}</a>";
  }
 }
}
If ($page == ceil($NumOfPages) ) { $startPage = $page; } else { $startPage = 1; }
for ($i = $startPage; $i <= $page+6; $i++) {
 if ($i <= ceil($NumOfPages)) {
 // $page is not the last page
  if($i == $page) {
  // $page is current page
   echo " [{$i}] "; } else {
    // Not the current page Hyperlink them
    echo "<a href="\"/{$i}\">{$i}</a> ";
   }
  }
 }


 
        // pull the user information from the table
        //$sql = "SELECT userdb_user_name, userdb_id, userdb_user_first_name, userdb_user_last_name FROM " . $config[table_prefix] . "userdb where userdb_is_agent = 'yes' order by userdb_user_name";
         $sql = "SELECT userdb_user_name, userdb_id, userdb_user_first_name, userdb_user_last_name FROM " . $config[table_prefix] . "userdb where userdb_is_agent = 'yes' order by userdb_user_name limit ". $limit." offset ".($limit * $page);
         $recordSet1 = $conn->Execute($sql);
        if ($recordSet1 === false) {
            $misc->log_error($sql);
        }
        while (!$recordSet1->EOF) {
            // loop through our users
            $name = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_name]);
            $first = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_first_name]);
            $last = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_last_name]);
            $userID = $misc->make_db_unsafe ($recordSet1->fields[userdb_id]);
            if ($var_reset == 0) {
                $display .= "<tr>";
            }
            $display .= "<td align=\"center\" valign=\"top\"><a href=\"$config[baseurl]/index.php?action=view_user&user=$userID\">";
             
            // get our image data using the userid
            $user = $misc->make_db_unsafe($userID);
            $sql = "SELECT userimages_id, userimages_caption, userimages_file_name, userimages_thumb_file_name FROM " . $config[table_prefix] . "userimages WHERE (userdb_id = $user) ";
            $recordSet = $conn->SelectLimit($sql, 1, 0 );
            if ($recordSet === false) {
                $misc->log_error($sql);
            }
            $num_images = $recordSet->RecordCount();
            if ($num_images > 0) {
               // while (!$recordSet->EOF) {
                    $caption = $misc->make_db_unsafe ($recordSet->fields[userimages_caption]);
                    $thumb_file_name = $misc->make_db_unsafe ($recordSet->fields[userimages_thumb_file_name] );
                    $file_name = $misc->make_db_unsafe ($recordSet->fields[userimages_file_name]);
                    $imageID = $misc->make_db_unsafe ($recordSet->fields[userimages_id]);
                    $imagedata = GetImageSize("$config[user_upload_path]/$thumb_file_name" );
                    $imagewidth = $imagedata[0];
                    $imageheight = $imagedata[1];
                    $shrinkage = $config[thumbnail_width]/$imagewidth;
                    $displaywidth = $imagewidth * $shrinkage;
                    $displayheight = $imageheight * $shrinkage;
                    $display .= "<img src=\"$config[user_view_images_path]/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\"><br> ";
                   // $recordSet->MoveNext();
               // }
            } else {
                $display .= "<img src=\"images/nophoto_1.gif\"><br>";
            }
             
            $display .= "<br>$first $last</a><br>";
            $display .= "</td>";
             
            if ($var_reset == $user_col_max) {
                $display .= "</tr>";
                $var_reset = 1;
            } else {
                $var_reset++;
            }
            $recordSet1->MoveNext();
        } // end While loop
        $display .= "</td></table><br>";
        return $display;
    } // end viewallusers_display_addon_page
     

    
    // Addon Specific Function
    function viewallusers_display_admin_page() {
    }
?>

this example can help you.
http://www.codediesel.com/php/simple-pagination-in-php/

i have been looking for days but i still don't understand.
i don't know coding, and i really tried but no luck.
i gess it will stay the way it is till i get some money in the future hopefully


thanks to all for trying to help.

Member Avatar for diafol

i don't know coding, and i really tried but no luck.

If you can't/won't code, you won't understand any solutions - as you mentioned. Probably your best bet will be to pay a php programmer. The time spent trying to find free solutions to your problems of forums will not be worth it in the long term. This is especially true if your website goes live and it then breaks or you get the occasional error. You will be totally stuffed - loyal users will leave in disgust. Asking a programmer to sift through amateur / patched code would be v. inefficient.

i understand that but if i could i would love to pay someone, i would love to have a nice web site but i can't, it is thought times right now and i don't make money from the site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.