Best way to check for end of a record and send it back to the first record


Posted on 16th Feb 2014 07:03 pm by admin

I'm hoping someone can help me out and explain the best way to accomplish this.

What I'm doing I'm pulling data from a data base. I display the information 1 item at a time then have a next and previous link to navigate forward or backward through the records.

Did you know?Explore Trending and Topic pages for more stories like this.
The issue is when it gets to the last record and I press the next link i get errors cause their is no more records. so what I'm wondering what a good way to send it back to the first record? would it make sense to store the total number of records in a variable and then load the load the id's pulled from the database into an array and check against the end of the array for the end of the records and send it back to the first element of the array?

Any explanations are examples would be helpful even a link to somewhere showing this would be good. I haven't found one yet.
No comments posted yet

Your Answer:

Login to answer
290 Like 13 Dislike
Previous forums Next forums
Other forums

mysqli_fetch_assoc returns multiple arrays, how to return a single array
Hello, I am using mysqli_fetch_assoc which is returning multiple rows, so it looks like:

Code

PHP Multiples of 2, Show posts...not working (wordpress)
I have been using this code to show div.example with 6 li columns inside it, each li is a post with

PHP & Java
Hello,

can PHP code be used inside java code?

Code: [Select]<SCRIPT LANGUAGE=&q

please help
HTML Code:

Code: <span id="ctl00"><span>

Object Interfaces
EDIT: Never mind, I just updated to php 5.

Hey all,

I'm currently experimenting with p

Pagination
Okay here is the page in question: http://blenderteachings.000a.biz/tutorials.hamishhill.php

Registration
ok so i have a site where people can register and login which works now thanks to someone on here th

Binding 2 UDP sockets on same port, connected to different destinations, 1 receives
Hello,
My application wants to send/recv data to 2 different UDP ports on a remote computer, us

WS-Security PL/SQL Forms
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - P

include problem
I have my root folder as:
Code: $root = $_SERVER["SITE_HTMLROOT"]; // the server root<

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash