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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:18:45+00:00 2026-06-03T05:18:45+00:00

I wanna input previous and next buttons for a forum that i have because

  • 0

I wanna input previous and next buttons for a forum that i have because after the forum gets to long, it surpasses the background image and doesn’t look good! Does anyone know either a simple way to do it or something i can look at for previous and next buttons? I want it so each page is limited to only 5 posts per page or something.

Heres the code if it helps at all. I’m sorry if this is a stupid question.

<?php 
$dbc=mysql_connect('host','user','password','database') or die(mysql_error());
mysql_select_db('database',$dbc) or die(mysql_error());
?>

View Posts <br>
<form method="get" action="view_forum.php">
  <label>Select Weather to Filter </label><br />
  <select name="weather">
    <option value="all">all</option>
    <option value="cloudy">Cloudy</option>
    <option value="sunny">Sunny</option>
    <option value="windy">Windy</option>
    <option value="snowy">Snowy</option>
    <option value="mixy">Wintery Mix</option>
    <option value="rainy">Rainy</option>
  </select>
  <input type="submit" value="view" />
</form>

<div id="view">
 <center><img src="images/forum.png" width="589" height="97"></center>
</div>  
  <div id="white">
    <div id="blue">
      <div id="grey">
       <div id="container">
<?php
$weather = mysql_real_escape_string( $_GET["weather"] ); // keep your input clean

if ( $weather == "all" ) {
  $sql = "SELECT * FROM stories ORDER BY id DESC";
} else {
  $sql = "SELECT * FROM stories WHERE weather = '$weather' ORDER BY id DESC";
}

$result = mysql_query( $sql ) or die( mysql_error() );

while ( $row = mysql_fetch_assoc( $result ) ) {

    echo "<div class=\"names\"> {$row['name']}<br /></div>";
    echo "<div class=\"weathers\">{$row['weather']}<br /></div>";
   echo "<div class=\"stories\">{$row['story']}<br /></div>";



        echo "<img src=\"images/line.png\" width='800' height='3'>";

         echo "<br />"; 
}

?>
</div>
</div>
</div>
</div>
  • 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-03T05:18:46+00:00Added an answer on June 3, 2026 at 5:18 am

    It’s easy. You keep a page variable in the request. As shown below

    if (!isset($_GET['page'])) {
       $page = 1;
    } else {
       $page = (int)$_GET['page'];
    }
    

    And in you SQL statement, you would put something like this, which uses the page variable to adjust the query limits:

    $query = 'SELECT * FROM someTable WHERE 1 LIMIT ' . (($page - 1) * $recordsPerPage) . ' ' . $recordsPerPage;
    

    Something like that anyways. Now for your Previous and Next links you put something like this, so that you can increment/decrement the page variable:

    <? if ($page > 1) : ?>
       <a href="self.php?page=<?= $page - 1 ?>">Prev</a>
    <? endif ?>
    <? if ($page != $maxPages) : ?>
       <a href="self.php?page=<?= $page + 1 ?>">Next</a>
    <? endif ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna have a drop down that lets me select Week Commencing Monday the
I wanna build a console app that may stop and prompt for some input,
I have an text input. I wanna limit number of its character downto 300.
I have a procedure that requires a string as input CREATE PROCEDURE testing(MYVAR VARCHAR)
I have a form that contains a phone number field <input name=phNumber type=text class=numbersonly/>
I have the following code that generates my form on my html page <input
I wanna constrain to input special signs like £ ¬ ¦ in javascript,but they
i wanna add a service behavior(or anything u'll suggest) that will automatically insert the
I wanna know that how we can identify whether a page is redirecting to
use=input('what do you wanna do \n1.press w to create a new file\n2.press r to

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.