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 4008228
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:43:43+00:00 2026-05-20T08:43:43+00:00

Hey everyone. So what i am looking to do is achieve a cleaner url

  • 0

Hey everyone. So what i am looking to do is achieve a cleaner url for my pagination. Currently I am passing variables through GET, and reloading the same page and modifying the query.

I am looking to do something like: http://designspiration.net/

Their pages show up as folders with the corresponding numbers. I am assuming they are doing this on the fly, but i am not sure how. Not particularly sure what I may be getting into, or what may be involved, but I am up for a challenge so let me know!

Here is the current test I have set up which uses $_GET. Already had some help with some online tutorials to get the theory down for the pagination.

<?php
$host = "localhost";
$username = "user";
$password = "pass";
$db_name = "database";
$directory = "/newProject";

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$postsPerPage = 2;
$start = $_GET['start'];
$totalRecords = mysql_num_rows(mysql_query("SELECT * FROM posts"));

if (!$start)
  $start = 0;

$result = mysql_query("SELECT * FROM posts ORDER BY id DESC LIMIT $start, $postsPerPage");

while ($post = mysql_fetch_assoc($result)){
  echo "<span>" ."Title: " .$post['title'] ."</span><br />\n";
  echo "<span>" ."Author: " .$post['author'] ."</span><br />\n";
  echo "<span>" ."Description: " .$post['description'] ."</span><br />\n";
  echo "<a href='full_post.php?id=" .$post['id'] ."'>\n" ."<img src='" .$directory .$post['thumbUrl'] ."' /></a>" ."<br />\n";
  echo "<span>" ."Type: " .$post['type'] ."</span><br />\n";
  echo "<span>" ."Tags: " .$post['tags'] ."</span><br />\n";
  echo "<span>" ."Submitted: " .$post['date'] ."</span><br />\n";
  echo "<span>" ."ID: " .$post['id'] ."</span><br /><br /><br />\n";
}

$prev = $start - $postsPerPage;
$next = $start + $postsPerPage;

//previous button
if (!($start<=0))
  echo "<a href='index.php?start=$prev'>Prev</a> ";

//page numbers
$pageNumbers = 1;

for($x=0;$x<$totalRecords;$x=$x+$postsPerPage){
  if ($start!=$x)
    echo "<a href='index.php?start=$x'> $pageNumbers</a> ";
  else
    echo "<a href='index.php?start=$x'><b> $pageNumbers</b></a> ";
  $pageNumbers++;    
}

//next button
if(!($start>=$totalRecords-$postsPerPage))  
  echo "<a href='index.php?start=$next'>Next</a>";

?>

My assumptions: I will be POST’ing the variable for my pagination/mysql_query to a new folder and index.php which I create on the fly based on my page number.. I also looked into a .htaccess rewrite rule which can modify the url, however I am a beginner with php, trying to learn, and this seems like a shortcut.

Post code, or just point me in the correct direction! Not having any luck through searches.

  • 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-05-20T08:43:44+00:00Added an answer on May 20, 2026 at 8:43 am

    Hey, what you are looking for is routing techniques, you could simply see how some frameworks do it, and implement it yourself, or just use the framework.
    The basic premise is to re-route all trafic to a specific file ( generally index.php) in that file parse the URI and separate what you want, then route to the appropriate code.

    re routing the request to the url is done via apache mod-rewrite, and then the parsing is up to you.

    See this documentation to see how zend does it.

    good luck

    edited to add this link that seems to be more readable

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey there, everyone. A really random question, but I'm looking to get into some
Hey everyone, I'm back and looking forward to more of your brilliance. I have
Hey everyone, I'm a bit new to SEO. I built a one page website
Hey everyone, So, I'm currently trying the implement the APNG Specification , but am
Hey everyone I am currently getting the next variable based on if a file
Hey everyone I'm currently extremely frustrated and can not figure this out have looked
Hey everyone. I'm looking for a good Active-Record like data abstraction layer to hook
Hey everyone i did some research online but i couldn't get a solution, hopefully
Hey everyone. I'm fairly new to VB.NET and I'm looking to create a module
Hey everyone. Hopefully I can explain this correctly. I have some URL's which I

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.