• Resolved jaliciense4784

    (@jaliciense4784)


    I am using wpdb to query a custom table. Then I am looking to paginate those results using paginate_links().

    I am getting a “>” character at the top of the table in my code. Here is my code

    I’m am trying to paginate a set of results from a database query using $wbdb class. I’ve got it to paginate but I”m getting some freaky results and I’m not sure if this is normal. The code is printing a “>” at the top of the table for each result the query returns. Can anyone tell me what I’m doing wrong.

    I’m using the following code that I got from

    $rows_per_page = 10;
    $current = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;

    $rows = $wpdb->get_results(‘SELECT * FROM subscribers ORDER BY lname ASC’);

    $start = ($current – 1) * $rows_per_page;
    $end = $start + $rows_per_page;
    $end = (sizeof($rows) < $end) ? sizeof($rows) : $end;

    $pagination_args = array(
    ‘base’ => @add_query_arg(‘paged’,’%#%’),
    ‘format’ => ‘?page=%#%’,
    ‘total’ => ceil(sizeof($rows)/$rows_per_page),
    ‘current’ => $current,
    ‘show_all’ => False,
    ‘prev_next’ => True,
    ‘prev_text’ => __(‘? Previous’),
    ‘next_text’ => __(‘Next ?’),
    ‘type’ => ‘plain’,
    ‘add_args’ => False
    );

    echo paginate_links($pagination_args);

    and here is a link to the page
    https://www.thewaymultimedia.com/IML/manage-subscribers/

    I’ve been at it for a few hours and just can’t figure out my mistakte. I”m using WordPress 3.5

Viewing 1 replies (of 1 total)
  • Thread Starter jaliciense4784

    (@jaliciense4784)

    So essentially this did not work because of the table. For some reason the paginate_link() function in WordPress does not work well with Tables, maybe it’s just the way I’m using it. When I used <div> tags to style my data, the “>” characters went away.

    but just in case you were curious I was getting an output that look like this:

    1 2 3 Next > > > >

    where the numbers are the pages for the pagination and the “>” were being added for each record that was returned from the database.

    Once I stopped using the table it went away.

    Hope this helps someone.

Viewing 1 replies (of 1 total)
  • The topic ‘paginate_links outputs a ">" character for each result’ is closed to new replies.