3 Replies - 13174 Views - Last Post: 30 June 2010 - 08:32 AM Rate Topic: -----

#1 itdesigner   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-June 10

How to create a Next button

Posted 19 June 2010 - 01:34 AM

Hello ! everyone

I am getting a problem when i display data from database.
problem is that i have 20 row in my database and i want to show only 4 rows in first then there should a next button to show the next 4 rows and so on..

please help me how to show the next rows by next button.

<?php 
// Get our database connector
require("includes/conn.php");
?>
        
        <body>
      
              <div>

                        <?php   
                                // Grab the data from our prod table
								$sql = "SELECT * FROM prod ";
                               
                                $result = mysql_query($sql) or die ("Could not access DB: " . mysql_error());

  while ($row = mysql_fetch_assoc($result))
   {
     echo "<div class=\"picture\">";
     echo "<p>";

                                        										 echo "<table>";
echo "<tr>";
echo "<td>";
echo "<img src=\"images/" . $row['filename'] . "\" alt=\"\" /><br />";
										echo "</td>";
										echo "<td>";
echo $row['pname'] . " " . $row['pprice'] . "<br />";
										echo "</td>";
										echo "<td>";
										echo $row['pcatg'];
										echo "</td>";
										echo "</tr>";
										echo "</table>";
echo "</p>";
echo "</div>";
                                }
                        ?>



Is This A Good Question/Topic? 0
  • +

Replies To: How to create a Next button

#2 mahcuz   User is offline

  • D.I.C Head
  • member icon

Reputation: 143
  • View blog
  • Posts: 213
  • Joined: 03-June 10

Re: How to create a Next button

Posted 19 June 2010 - 01:41 AM

The concept is known as Pagination. See this tutorial on the subject.
Was This Post Helpful? 3
  • +
  • -

#3 itdesigner   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-June 10

Re: How to create a Next button

Posted 29 June 2010 - 10:34 PM

View Postmahcuz, on 19 June 2010 - 01:11 PM, said:

The concept is known as Pagination. See this tutorial on the subject.

Thank you Mahcuz i have try its working very well, there are many errors when i implied on my code now every thing is solve. last error is 'page' variable when we are showing first page when click next error is gone
there is an undefined error.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101   User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12769
  • View blog
  • Posts: 45,954
  • Joined: 27-December 08

Re: How to create a Next button

Posted 30 June 2010 - 08:32 AM

We can't help you if you don't post your code, as well as the error you are seeing on the browser window and the line numbers. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1