Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7965937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:17:13+00:00 2026-06-04T06:17:13+00:00

I have a pagination inside an user profile. When I’m inside the test profile

  • 0

I have a pagination inside an user profile.

When I’m inside the test profile the URL is profile.php?uid=1

But now I want to use a pagination to wiev the information from a SQL database.
When I try the pagination on another page it works fine, but as you know the pagination change the URL depends on what side your on.

So my problem is that the pagination change my profile.php?uid=1 to profile.php?page=2

Do you have any tips on how to fix that error ?

This is my pagination code.

/*pagination */ 
    $per_page = 5;
    //$pages_query = mysql_query("SELECT COUNT('user_id') FROM users");

    $pages_query = mysql_query("SELECT COUNT('file_name') FROM users WHERE  `user_name` = '{$_SESSION['username']}' ") or die(mysql_error()); 
    $pages = ceil(mysql_result($pages_query, 0) /$per_page);

    $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
    $start = ($page - 1) * $per_page;

    <?php  
 $data = mysql_query("SELECT * FROM users LIMIT $start, $per_page")
 or die(mysql_error()); 
 echo "<table border cellpadding=1>"; 
 while($info = mysql_fetch_array( $data )) 
    { ?><?php
        echo "<tr>"; 
//      echo "<td>".$info['user_id'] . "</td> "; 
        echo "<td>".$info['user_name'] . "</td> ";
    //  echo "<td>".$info['file_name'] . "</td> ";
        ?>
        <td> <a href="download.php?user_id=<?php echo $info['user_id'];?>"> <?php echo $info['file_name']; ?></a></td>
        <?php
        echo "<td>".date('d/m/Y') . "</td>" ;


    }
        echo "</tr>";
        echo "</table>"; 


 if($pages >= 1 && $page <=$pages){

 for ($x = 1; $x<=$pages; $x++){ 

 echo ($x == $page) ? '<strong><a href="?page='.$x.'">' .$x. '</a> </strong>' : '<a href="?page=' .$x. '">' .$x. ' </a> ';

 }

 }

 ?> 

/*pagination */

And the profile

function fetch_user_info($uid){
$uid = (int)$uid;

    $sql = "SELECT
    `user_name` AS `username`,
    `user_email` AS `email`
FROM `users`
WHERE `user_id` = {$uid} ";

$result = mysql_query($sql);

return mysql_fetch_assoc($result);

}

 $data = mysql_query("SELECT * FROM users") or die(mysql_error()); 

$files = mysql_query("SELECT `file_name` FROM users WHERE  `user_name` = '{$_SESSION['username']}' ") or die(mysql_error()); 
$user_info = fetch_user_info($_GET['uid']);  

I really dont have a clue on how to fix this =/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:17:14+00:00Added an answer on June 4, 2026 at 6:17 am

    Looks like you’re not passing the user id in your pager links, try changing this line…

    echo ($x == $page) ? '<strong><a href="?page='.$x.'">' .$x. '</a> </strong>' : '<a href="?page=' .$x. '">' .$x. ' </a> ';
    

    to

    echo ($x == $page) ? '<strong><a href="?uid='.$_GET['uid'].'&page='.$x.'">' .$x. '</a> </strong>' : '<a href="?uid='.$_GET['uid'].'&page=' .$x. '">' .$x. ' </a> ';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have pagination functionality that displays the total page count, but I was
well i have a class pagination <?php class Pagination { public $current_page; public $per_page;
I have recently used a PHP pagination tutorial, Pagination - what it is and
I have been using solr search and now I am adding pagination via the
I have a php page that also has another php page inside it, this
I have a pagination functionality, where the user can either enter page number OR
I have applied the class of pagination in the search result to page search-result.php
I've built a PHP AJAX pagination that works with an HTML Table. I have
I have a gridview inside a div.. I want to scroll to top of
I am having trouble with modifying a php application to have pagination. My error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.