Paginate Results from SQL Query
-
Hi all
I am not very technical in terms of website building and feel i have done an ok job on my website.i have a page for Our Properties, where all the properties I rent out appear with the use of a database an SQL query that brings them back.
However, I have started to play with adding sliders for the picture of the property which i have found has slowed down the performance.
I was thinking about adding pagination and after searching through the support on here and google i am at a lose as to what to do next.
simply this is the page Our Properties i want to paginate in which 20 properties are to appear and then a user can click next page and the next 20 appear
I am at a complete loss as to what to do.
this is a snippet of my code if this helps
[insert_php]$servername = "..........";$username = ".......";$password = "........";$dbname = "........."; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT <code>Property Thumbnail URL</code>,<code>Property Title4HTML</code>,<code>Image Tag</code> FROM <code>Properties</code>,<code>Available</code> WHERE <code>Property Available Flag</code> = <code>Flag</code> ORDER BY <code>Property Number</code>"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "<tr> <td>" . $row['Property Thumbnail URL'] . "</td><td>" . $row['Property Title4HTML'] . "</td><td>" . $row['Image Tag'] . "</td> </tr>"; } } else { echo "0 results"; } $conn->close(); [/insert_php]
- The topic ‘Paginate Results from SQL Query’ is closed to new replies.